-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: RE: thread local and disconnect in EJB ??
PostPosted: Thu Aug 28, 2003 2:52 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Hellu,
I just posted this to the old newsgroup and noticed too late it was already closed.
Soooo here again, please some help:
-------------
Hellu again Steve,

I got a "big" problem dealing with those hibernate sessions between two EJB's that run in Jboss 3.2.2. RC2. in combination with hibernate2.

I am using the threadlocal thing exactly as you explaned above and that almost works just fine.... but not completely:
- It works when I connect from EJB A to EJB B whereby EJB A doesn't requested a hibernate session yet.
- It doesn't work when I connect from EJB A to EJB B when I am already using a hibernate session and connect to B that also have a session. B doesn't close the session but Jboss "complains" heavily about "trying to retun an unkown connection"...See the stacktrace below...
I can figger out what this could be :)
I tried also jboss 3.2.1 and 3.2.2RC3 but it does the same.
In my method I request a session at the start of my metho and give it back in the finally of the method, exactly like you do above....

Obivously Jboss sees there is still a connection open and wants to close is but why ?? I mean... I want it to stay open and continue to use it again in EJB A...
BTW: I use transaction level Required in my Ejb methods.

Any idea how to solve this problem ?

Ed


----- Stack trace of Jboss console:

20:25:12,263 INFO [TxConnectionManager$TxConnectionEventListener] throwable from unregister connection
java.lang.IllegalStateException: Trying to return an unknown connection1! org.jboss.resource.adapter.jdbc.WrappedConnection@2b7632
at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:264)
at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:550)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:287)
at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:127)
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:324)
at org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll(CachedConnectionManager.java:375)
at org.jboss.resource.connectionmanager.CachedConnectionManager.popMetaAwareObject(CachedConnectionManager.java:199)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:190)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:353)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
at $Proxy128.getValidSellingCase(Unknown Source)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:195)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
20:25:12,704 INFO [CachedConnectionManager] Successfully closed a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@2b7632
java.lang.Exception: Stack Trace
at org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll(CachedConnectionManager.java:376)
at org.jboss.resource.connectionmanager.CachedConnectionManager.popMetaAwareObject(CachedConnectionManager.java:199)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:190)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:353)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
at $Proxy128.getValidSellingCase(Unknown Source)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:195)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
20:25:13,094 INFO [STDOUT] Hibernate: select mtickpay0_.id as id, mtickpay0_.name as name, mtickpay0_.description as descript3_ from mtick_payment_method mtickpay0_ where (mtickpay0_.id=? )
20:25:13,104 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
20:25:13,114 ERROR [JDBCExceptionReporter] Connection handle has been closed and is unusable
20:25:13,124 ERROR [JDBCExceptionReporter] Could not execute query
java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:218)
at net.sf.hibernate.impl.SessionFactoryImpl.getPreparedStatement(SessionFactoryImpl.java:404)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:56)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:559)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:167)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:113)
at net.sf.hibernate.loader.Loader.find(Loader.java:736)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:957)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1373)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1352)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1348)
at com.logicacmg.mticket.core.common.BasePersistSession.find(BasePersistSession.java:165)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:196)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
20:25:13,495 ERROR [BaseException] com.logicacmg.mticket.core.order.intf.OrderManagerException, errorCode: Could not complete ticket order.

Nested exception is:
com.logicacmg.mticket.core.common.PersistSessionException, errorCode: Persist error

Nested exception is:
java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:218)
at net.sf.hibernate.impl.SessionFactoryImpl.getPreparedStatement(SessionFactoryImpl.java:404)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:56)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:559)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:167)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:113)
at net.sf.hibernate.loader.Loader.find(Loader.java:736)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:957)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1373)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1352)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1348)
at com.logicacmg.mticket.core.common.BasePersistSession.find(BasePersistSession.java:165)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:196)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
rethrown as net.sf.hibernate.JDBCException: Could not execute query: Connection handle has been closed and is unusable
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1376)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1352)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1348)
at com.logicacmg.mticket.core.common.BasePersistSession.find(BasePersistSession.java:165)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:196)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:218)
at net.sf.hibernate.impl.SessionFactoryImpl.getPreparedStatement(SessionFactoryImpl.java:404)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:56)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:559)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:167)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:113)
at net.sf.hibernate.loader.Loader.find(Loader.java:736)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:957)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1373)
... 35 more



20:25:14,276 INFO [STDOUT] ##Persist session nesting level decremented [0]
20:25:15,778 INFO [PersistSessionStorage] Closing Persist session
20:25:15,788 INFO [STDOUT] ##Returning Persist session.
20:25:15,788 ERROR [JDBCExceptionReporter] Cannot close connection
java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.getWarnings(WrappedConnection.java:603)
at net.sf.hibernate.impl.SessionFactoryImpl.closeConnection(SessionFactoryImpl.java:306)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3043)
at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:469)
at com.logicacmg.mticket.core.common.BasePersistSession.close(BasePersistSession.java:94)
at com.logicacmg.mticket.core.common.PersistSessionStorage.closeSession(PersistSessionStorage.java:77)
at com.logicacmg.mticket.core.common.GeneralManagerEjb.closePersistSession(GeneralManagerEjb.java:41)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:363)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
20:25:16,089 ERROR [GeneralManagerEjb] Error disconnecting Persist session: com.logicacmg.mticket.core.common.PersistSessionException, errorCode: Persist error

Nested exception is:
java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.getWarnings(WrappedConnection.java:603)
at net.sf.hibernate.impl.SessionFactoryImpl.closeConnection(SessionFactoryImpl.java:306)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3043)
at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:469)
at com.logicacmg.mticket.core.common.BasePersistSession.close(BasePersistSession.java:94)
at com.logicacmg.mticket.core.common.PersistSessionStorage.closeSession(PersistSessionStorage.java:77)
at com.logicacmg.mticket.core.common.GeneralManagerEjb.closePersistSession(GeneralManagerEjb.java:41)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:363)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
rethrown as net.sf.hibernate.JDBCException: Cannot close connection: Connection handle has been closed and is unusable
at net.sf.hibernate.impl.SessionFactoryImpl.closeConnection(SessionFactoryImpl.java:311)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3043)
at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:469)
at com.logicacmg.mticket.core.common.BasePersistSession.close(BasePersistSession.java:94)
at com.logicacmg.mticket.core.common.PersistSessionStorage.closeSession(PersistSessionStorage.java:77)
at com.logicacmg.mticket.core.common.GeneralManagerEjb.closePersistSession(GeneralManagerEjb.java:41)
at com.logicacmg.mticket.core.order.impl.OrderManagerEjb.doOrder(OrderManagerEjb.java:363)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.sql.SQLException: Connection handle has been closed and is unusable
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:800)
at org.jboss.resource.adapter.jdbc.WrappedConnection.getWarnings(WrappedConnection.java:603)
at net.sf.hibernate.impl.SessionFactoryImpl.closeConnection(SessionFactoryImpl.java:306)
... 37 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 3:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Welcome to the new forum ;o)...

OK, here is exactly how I do this:
Code:
public class SessionBeanA ...
{
    SessionBeanBLocal b = ...;
    public void methodOnA()
    {
        prepareCall();
        try
        {
            b.methodOnB();
        }
        catch( Exception e ) {...}
        finally
        {
            endCall();
        }
    }
    ...
}

public class SessionBeanB ...
{
    public void methodOnB()
    {
        prepareCall();
        try
        {
            // do somethig
        }
        catch( Exception e ) { ... }
        finally
        {
            endCall();
        }
    }
    ...
}


Where prapareCall() and endCall() are defined on a common super class as:

Code:
protected void prepareCall()
{
    LoggingContext.set( "USER", getUserName() );
    HibernateSession.currentSession();
    getLogger().debug( "Call prepared" );
}

protected void endCall()
{
    try
    {
        getLogger().debug( "Starting endCall()" );
        HibernateSession.closeSession();
        LoggingContext.remove( "USER" );
    }
    catch( Throwable t )
    {
        getLogger().warn( "There was an error performing endCall()functionality", t );
    }
}


Please note also, as I mentioned in a previous post, that I am not using the normal ThreadLocalSession class, but a customized version. I did add this code to the ThreadLocalSession pattern section on the Hibernate web site. It is explicitly this new version which allows me to do this nested calling.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 3:56 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Thanx Steve,

But I am a bit lost now. Still some questions:
- Must the preparCall not return a session to work on ??

- I I got to B and get back to A, how can I then continue using the sessoin ?
I mean: if understood your code well, I see that you do a disconnect of the session in the endCall in B before returning to A. But that means that I lost my session in A after calling B and can't continue using the session... not ?? so what do I do when I want to continue using it ?

Isn't it possible to do a disconnect when the nestlevel counter > 0 and do a close when it hits 0 ? Then in a session wrapper you always check if you are connected and perform a reconnect if necessary ?? .. something like that ?!

Ed


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 4:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
Must the preparCall not return a session to work on

I am typically not doing anything with the hibernate session in my session ejbs. The stuff in prepareCall() is simply meant to "prime" the thread local with a session if one does not exist.

Quote:
I got to B and get back to A, how can I then continue using the sessoin

Because the session is still on the thread local. Walk/step through the code and convince yourself this is actually what happens...

Code:
initially ---------------> level = (n/a)
methodOnA() --------> level = (n/a)
    prepareCall() -----> level = 1
    methodOnB() -----> level = 1
        prepareCall() --> level = 2
        doSomething()-> level = 2
        endCall() -------> level = 1
    endCall() ----------> level = 0


Level never reaches zero until that second endCall() invocation, and thus the hibernate session is open that entire time after the prepareCall invocation in methodOnA().

I'm sorry if this isn't working for you in JBoss. I have never used JBoss, but I am uncertain as to why it would be wanting to close it after session bean b completes.

It might be helpful to get some logging strictly from the session beans and the thread local session just to see what is happening when.[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 5:14 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Hellu Steve,

Hmmmm I will have a closer look at it and give it a try... but how come you know all this and you don't use Jboss....?!?
What is your opinion about the combination Jboss and hibernate.. ? when would you use both ? and not just hibernate POJO ?

Tx again,
Ed[/i]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 5:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
but how come you know all this and you don't use Jboss

Depends what you mean by "all this". Most of what we have been discussing is j2ee stuff, not specific to jboss. I just happen to use weblogic, not jboss.

As for your other question, it really just depends... Both have tradeoffs. Session EJBs are nice because you can use declarative CMT in your deployment descriptors. But EJB in general adds a whole slew of (unecessary) complexities.

If you use the new jboss, why not try out its transaction AOP stuff for POJO. That could get you the best of both worlds.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 5:35 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Steve,

I had a closer look at what you write but what you do is basically what you wrote in one of your earlier mail about getting and closing a connection.

I also use that special ThreadLocal version to allow nested method calls.
But stilll I had a look in the jboss forums and understand that the connection must be closed if you leave the EJB, which isn't the case how I use a session now and neither they way you write above.... (I think)...

So, I think I should solve it differently..., something like this:
disconnect the db connection at the end of every method if the level > 0, close it otherwise.
I already use a session wrapper around the hibernate session and I think I have to reconnect every time I discover the connection is disconnected...
What will this have a correct behavior ??

At this moment I don't see any other way, I mean: I have to disconnect the connection when leaving the EJB..

There must be other people using Hibernate and Jboss with several EJB's... I like to know how they solve this problem ??

What about Weblogic, you us that not ?? Don't you have this problem ?

Ed


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2003 5:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I've just directed this question to Bill Burke. See if he can give some kind of answer.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 8:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Don't know what to tell you. This works fine in weblogic. I don't understand why this would not work in any app server. It really should not be dependent upon nested ejb call boundaries. It would be highly dependent upon transaction boundaries (even in weblogic). Are you certain each of the session bean methods you reference are set for CMT attribute of "Required"?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 12:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Just had another thought. Are you using remote interface calls between the ejbs, or local interface calls?

I can see where remote interface calls would cause a problem like this.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 7:34 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Hellu again,

Phooeee, I did some more testing and found out the following interesting things:
- I get this error only if I have requested a session in my Ejb A and haven't used it yet till I go to EJB B were I use the same session.

So, the one that gives the error (just after getting back from Ejb B):

Code:
EJB A:
methodtoB {
b = get ref to EjbB
get session
b.methodinB
[b] sesion.find("something")[/b]


The one that doesn't give the error:
Code:
EJB A:
methodtoB {
b = get ref to EjbB
get session
[b] sesion.find("something")[/b]
b.methodinB


Method in EJB B does something like:
[code]
session.fing(something again)
[/close]


So I think that when I retrieve a session I don't have a db connection yet untill I really use it. So when I get in the EJb B (in situation that is incorrect), and really start using the session through a find, exactly get a db connection, so when I leave Ejb B JBoss thinks: " I gave out the connection, so I want it back when you leave ".... instead as when I get in with a session already.... you are "allowed" to go out with one ....

Could it be something like that ??
When is hibernate really opening/retrieving a connection ???

Please some help ??


I am still strugling with the following question:
1) Yes use Jboss... or just POJO with hibernate. Steve, ... you told me that it's nice to use the CMT of a J2Ee app, but stillll you can perfectly do that with Hibernate as well not ?? and even hide it in something like a endCall.. (see your exampel above)...
I am still not confinced about using Jboss with hibernate... It only gives me trouble and cost me a lot of time development/testing/deployment.... I mean, Hibernate is comming out with cluser caching support soon.... so ... !?!?

Please some advice on this... to find me more arguments on to use JBoss.. ;)
Ed


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 7:35 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Something more:

Steven,

I use local calls between tje EJb's itself... but why do you thinkg I could get into trouble when using remote calls ???

Ed


Top
 Profile  
 
 Post subject: fix?
PostPosted: Fri Aug 29, 2003 8:11 pm 
Newbie

Joined: Fri Aug 29, 2003 8:02 pm
Posts: 8
Not sure if this is the fix, but in conf/standardjboss.xml remove this line in every container configuration

<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>

AFAICT, this won't affect anything, but I can't promise anything because I didn't write the JCA layer.

This interceptor is responsible for cleaning up call connections created within the call of an EJB, no matter what level of indirection this connection is created within. Its a stupid implementation. Sorry.... We'll fix this.

It is supposed to be a helper interceptor to catch when you've been sloppy about closing your JDBC connections. The idea was that the EJB boundary was a isolated boundary. This doesn't make much sense with Local access, now does it? Leaked connections should really be closed at tx commit or rollback IMNSHO.

Bill

_________________
============
Bill Burke
Chief Architect
JBoss Group, LLC
============


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 8:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
I am still not confinced about using Jboss with hibernate... It only gives me trouble and cost me a lot of time development/testing/deployment.... I mean, Hibernate is comming out with cluser caching support soon.... so ...




Guys, Bill and I (and Alex?) will work together to get this stuff working smoothly so don't worry too much. JBoss has always been the most popular platform for Hibernate apps so this is very important to me.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 8:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I mention that calls on the remote interfaces of the ejbs might cause problems because it would depend on how your container is implementing those calls. I'm pretty sure that it is not a requirement that calls on the remote interface of an ejb from another ejb actually happen on the same server (and thus not on the same thread). Weblogic, for example, attempts to optimize those calls into local calls if the second ejb is deployed in the same container space...

Quote:
When is hibernate really opening/retrieving a connection

aside from manually providing hibernate with connections, the connection is not obtained until first use (of course *use* could be as simple as calling Session.connection() to prime it). From your further tests, it does appear that maybe this is an issue in jboss. I am not certain if that is by j2ee spec or not, i'd have to re-read those sections. I am certainly having no issues with this in weblogic.

Quote:
but stillll you can perfectly do that with Hibernate as well

Most definitely. But to use JTA/XA transactions, Hibernate still needs to be given a TransactionManager to utilize. j2ee containers just make this kind of setup "easier" (I think its easier). But you can even explore using a stand-alone transaction manager like Tyrex without having to do a full-blown j2ee app.

Look, sometimes j2ee is simply overkill for a given problem. A j2ee container is nice if you need to coordinate transactions across multiple databases and have JMS and LDAP operations performed within the same transaction markings. If you are simply needing transactional consistency against a single database, then JTA is just simply not needed.

Setting up a j2ee app is not easy the first few times. If you are finding you need a setup like j2ee, but cant seem to get it working the way you like or are just frustrated with it maybe try out something like EnterpriseObjectBroker(EOB) or POJO/Tyrex. I really want to investigate Hibernate and Apache Avalon/Merlin, so theres another route.

HTH


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.