Konuyu görüntüle
IUCODERS FORUM > Programlama > JAVA > EJB nestedSqlException
Yazar
audtou


avatar
malatya
Kayıt: 31.08.2006
20.05.2009-21:16 #60093
Ders ve Gunler adında iki tane entity beanim var.M to N bağlantıları var.Bu bağlantıda DersProgrami tablosunda tutuluyor.
DersProgrami şöyle
int ders_id;
int gun_id;
int kredi;

DersProgrami'nin anahtar alanı ders_id ve gun_id oldugu icin DersProgrami adında bi entity beanim var.Ve identity'yi oluşturan DersProgramiPK embedded bean'i var.
@Embeddable
public class DersProgramiPK implements Serializable{
    private Ders ders;
    private Gunler gun;

    public DersProgramiPK() {
    }

    public DersProgramiPK(Ders d, Gunler g) {
        this.ders = d;
        this.gun  = g;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ders_id")
    public Ders getDers() {
        return this.ders;
    }
    public void setDers(Ders value) {
        this.ders = value;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="gun_id")
    public Gunler getGun() {
        return this.gun;
    }
    public void setGun(Gunler value) {
        this.gun = value;
    }

    @Override
    public boolean equals(Object obj){
        boolean equal = false;
        if(obj != null && obj instanceof DersProgramiPK){
            DersProgramiPK pk = (DersProgramiPK)obj;
            if(this.getDers().equals(pk.getDers()) && this.getGun().equals(pk.getGun())){
                equal = true;
            }
        }
        return equal;
    }
    @Override
    public int hashCode(){
        return this.toString().hashCode();
    }
}

DersProgrami:
@Entity
@NamedQueries({
    @NamedQuery(name = DersProgrami.GUNE_GORE_DERSLERI_BUL, query = "SELECT dp.pk.ders FROM DersProgrami dp WHERE dp.pk.gun = :gun"),
    @NamedQuery(name = DersProgrami.DERSIN_GUNLERINI_BUL,   query = "SELECT dp.pk.gun FROM DersProgrami dp WHERE dp.pk.ders = :ders")})
public class DersProgrami implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final String ENTITY_NAME = "DersProgrami";

    public static final String GUNE_GORE_DERSLERI_BUL = DersProgrami.ENTITY_NAME + ":guneGoreDersleriBul";
    public static final String DERSIN_GUNLERINI_BUL   = DersProgrami.ENTITY_NAME + ":dersinGunleriniBul";

    private DersProgramiPK pk;
    private Integer kredi;

    @TableGenerator(name = DersProgrami.ENTITY_NAME,
    table = "Generator_Table",
    pkColumnName = "ad",
    pkColumnValue = DersProgrami.ENTITY_NAME,
    valueColumnName = "deger",
    initialValue = 100,
    allocationSize = 1)
    @EmbeddedId
    @GeneratedValue(strategy = GenerationType.TABLE, generator = DersProgrami.ENTITY_NAME)
    public DersProgramiPK getPk() {
        return pk;
    }

    public void setPk(DersProgramiPK pk) {
        this.pk = pk;
    }

    public Integer getKredi() {
        return kredi;
    }

    public void setKredi(Integer kredi) {
        this.kredi = kredi;
    }

    public DersProgrami() {
    }
}

yukardaki DersProgrami entity beani ile DersProgrami tablosuna kayit ekleyebiliyorum.şu şekilde:
    public void dersEkle(Ders ders, Gunler gun, Integer kredi) {
        DersProgramiPK pk = new DersProgramiPK(ders, gun);
        DersProgrami dp = new DersProgrami();
        dp.setPk(pk);
        dp.setKredi(kredi);
        this.create(dp);
    }

ancak DERSIN_GUNLERINI_BUL isimli query'de
query = "SELECT dp.pk.gun FROM DersProgrami dp WHERE dp.pk.ders = :ders"

şu hatayı alıyorm.
Exception in thread "main" javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connection
        at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
        at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
        at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:159)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:65)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:219)
        at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
        at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
        at $Proxy250.find(Unknown Source)
        at session.DersProgramiFacade.dersinGunleriniBul(DersProgramiFacade.java:72)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
        at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_17923264.invoke(InvocationContextInterceptor_z_fillMethod_17923264.java
)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_17923264.invoke(InvocationContextInterceptor_z_setup_17923264.java)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
        at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:159)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:65)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
        at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:486)
        at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:56)
        at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
        at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
        at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
        at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
        at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
        at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
        at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)

Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 7f000101:c5f4:4a1443b2:65
 status: ActionStatus.ABORTING >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac

, BasicAction: 7f000101:c5f4:4a1443b2:65 status: ActionStatus.ABORTING >)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
        ... 134 more
Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: 7f000101:c5f4:4a1443b2:65 status: ActionStatus.ABORTING >
        at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:370)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
        at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection
(BaseConnectionManager2.java:941)
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)

aslında sorun bi dersin gunlerine ulaşırken ortaya çıkıyor.mapping kerde mi bi sorun var acaba?
yardımcı olabilirmisiniz?





bitiyo lan!
Yazar
audtou


avatar
malatya
Kayıt: 31.08.2006
21.05.2009-00:17 #60111
00:12:27,590 WARN  [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@6d8073
[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@1318ec7 
handles=1 lastUse=1242853896071 permit=true 
trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@17d0638
 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@12387eb xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@2a05d9
 txSync=null] java.lang.IllegalStateException: BaseClassLoader@4eaf47{vfszip:/home/taskin/Progs
/jboss-5.0.0.GA/server/default/deploy/BTRM.jar} classLoader is not connected to a domain (probably undeployed?) 
for class java.util.NoSuchElementException


00:12:27,593 ERROR [JDBCExceptionReporter] Error; - nested throwable: (java.lang.IllegalStateException:
 BaseClassLoader@4eaf47{vfszip:/home/taskin/Progs/jboss-5.0.0.GA/server/default/deploy/BTRM.jar} 
classLoader is not connected to a domain (probably undeployed?) for class java.util.NoSuchElementException)



java.lang.IllegalStateException: BaseClassLoader@4eaf47{vfszip:/home/taskin/Progs/jboss-5.0.0.GA
/server/default/deploy/BTRM.jar} classLoader is not connected to a domain (probably undeployed?) 
for class java.sql.SQLWarning


bazı düzenlemelerden sonra bu hatalar devam ediyor d oh






bitiyo lan!
Yazar
orhan


avatar
istanbul
admin
Kayıt: 17.11.2005
21.05.2009-11:30 #60127
Hala aynı problem var mı?





N/A
Yazar
audtou


avatar
malatya
Kayıt: 31.08.2006
21.05.2009-12:32 #60133
orhan yazdi
 
Hala aynı problem var mı?

evet abi maalesef worried





bitiyo lan!
Yazar
audtou


avatar
malatya
Kayıt: 31.08.2006
21.05.2009-21:22 #60180
orhan yazdi
 
Hala aynı problem var mı?

anlamadığım bi şekilde problem halloldu.hayırdır inşallah.demek ki bilgisayarı kapatıp açmak gerekiyomuş bazen beat up
teşekkrler orhan





bitiyo lan!
Yazar
audtou


avatar
malatya
Kayıt: 31.08.2006
21.05.2009-21:23 #60181
DersProgrami:
@Entity
@NamedQueries({
    @NamedQuery(name = DersProgrami.GUNE_GORE_DERSLERI_BUL, query = "SELECT dp.pk.ders FROM DersProgrami dp WHERE dp.pk.gun = :gun"),
    @NamedQuery(name = DersProgrami.DERSIN_GUNLERINI_BUL,   query = "SELECT dp.pk.gun FROM DersProgrami dp WHERE dp.pk.ders = :ders")})
public class DersProgrami implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final String ENTITY_NAME = "DersProgrami";

    public static final String GUNE_GORE_DERSLERI_BUL = DersProgrami.ENTITY_NAME + ":guneGoreDersleriBul";
    public static final String DERSIN_GUNLERINI_BUL   = DersProgrami.ENTITY_NAME + ":dersinGunleriniBul";

    private DersProgramiPK pk;
    private Integer kredi;

    @TableGenerator(name = DersProgrami.ENTITY_NAME,
    table = "Generator_Table",
    pkColumnName = "ad",
    pkColumnValue = DersProgrami.ENTITY_NAME,
    valueColumnName = "deger",
    initialValue = 100,
    allocationSize = 1)
    @EmbeddedId
    @GeneratedValue(strategy = GenerationType.TABLE, generator = DersProgrami.ENTITY_NAME)
    public DersProgramiPK getPk() {
        return pk;
    }

    public void setPk(DersProgramiPK pk) {
        this.pk = pk;
    }

    public Integer getKredi() {
        return kredi;
    }

    public void setKredi(Integer kredi) {
        this.kredi = kredi;
    }

    public DersProgrami() {
    }
}

composite id oldugu için TableGenerator olmayacak tabiki de dogrusu şöyle:
@Entity
@NamedQueries({
    @NamedQuery(name = DersProgrami.GUNE_GORE_DERSLERI_BUL, query = "SELECT dp.pk.ders FROM DersProgrami dp WHERE dp.pk.gun = :gun"),
    @NamedQuery(name = DersProgrami.DERSIN_GUNLERINI_BUL,   query = "SELECT dp.pk.gun FROM DersProgrami dp WHERE dp.pk.ders = :ders")})
public class DersProgrami implements Serializable {

    private static final long serialVersionUID = 1L;
    public static final String ENTITY_NAME = "DersProgrami";

    public static final String GUNE_GORE_DERSLERI_BUL = DersProgrami.ENTITY_NAME + ":guneGoreDersleriBul";
    public static final String DERSIN_GUNLERINI_BUL   = DersProgrami.ENTITY_NAME + ":dersinGunleriniBul";

    private DersProgramiPK pk;
    private Integer kredi;

    
    @EmbeddedId
    public DersProgramiPK getPk() {
        return pk;
    }

    public void setPk(DersProgramiPK pk) {
        this.pk = pk;
    }

    public Integer getKredi() {
        return kredi;
    }

    public void setKredi(Integer kredi) {
        this.kredi = kredi;
    }

    public DersProgrami() {
    }
}






bitiyo lan!
Del.icio.us
Digg
Facebook
Furl
Google
Blink
Simpy
Spurl
Y! MyWeb