ok. To describe the problem I am facing futher,
Environment:
Hibernate 3.2 , Websphere 6.0, Jbosscache 1.3.0SP4, Jbosscache 1.4.0GA
I have enabled Jboss cache as second level cache for Hibernate. Currently it is in a non-clustered and replicated environment. The application uses EJBs and I have a session bean method which participates in a container managed transaction and invokes the hibernate DAO to fetch data. I get the exception below on invoking the method from a EJB client.
Excerpt from hibernate.cfg.xml are as follows :
Code:
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.transaction.auto_close_session">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.TreeCacheProvider</property>
relevant section from treecache.xml
Code:
<attribute name="TransactionManagerLookupClass">org.jboss.cache.GenericTransactionManagerLookup</attribute>
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<attribute name="CacheMode">LOCAL</attribute>
Stacktrace:
Code:
[12/14/06 16:14:42:247 IST] 0000002d ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declare
d) exception during invocation of method "getValidValuesWithCMT" on bean "BeanId(HibernateCacheProjectEAR#HibernateCacheProject.jar#ValidValueSessionBean, null)". Exception data: java.lang.UnsupportedOperationException
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.suspend
(WebSphereExtendedJTATransactionLookup.java:105)
at org.hibernate.cache.TreeCache.suspend(TreeCache.java:101)
at org.hibernate.cache.TreeCache.put(TreeCache.java:71)
at org.hibernate.cache.TransactionalCache.put(TransactionalCache.java:50)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:156)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.acs.enterprise.common.program.dataaccess.dao.impl.ValidValueDAOImpl.getValidValueDomainDetail
(ValidValueDAOImpl.java:170)
at ejbs.ValidValueSessionBeanBean.getValidValuesWithCMT(ValidValueSessionBeanBean.java:69)
at ejbs.EJSRemoteStatelessValidValueSessionBean_96e1942d.getValidValuesWithCMT(EJSRemoteStatelessVal
idValueSessionBean_96e1942d.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.rmi.util.ProxyUtil$4.run(ProxyUtil.java:727)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:351)
at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:725)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1121)
at $Proxy2.getValidValuesWithCMT(Unknown Source)
at ejbs._ValidValueSessionBean_Stub.getValidValuesWithCMT(_ValidValueSessionBean_Stub.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:65)
at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:111)
at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:370)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:42
1)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:36
7)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
[12/14/06 16:14:42:325 IST] 0000002d OrderedSynchr E failed calling afterCompletion() on TxIntercept
or.LocalSynchronizationHandler(gtx=GlobalTransaction:<null>:1, tx=org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$Tra
nsactionAdapter@0)
[12/14/06 16:14:42:325 IST] 0000002d OrderedSynchr E TRAS0014I: The following exception was logged j
ava.lang.IllegalStateException: illegal status: 5
at org.jboss.cache.interceptors.TxInterceptor$RemoteSynchronizationHandler.afterCompletion(TxInterce
ptor.java:1019)
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.afterCompletion(TxIntercep
tor.java:1103)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.afterCompletion(OrderedSynchronization
Handler.java:83)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$1.invoke(WebSphereExtendedJTATran
sactionLookup.java:133)
at $Proxy3.afterCompletion(Unknown Source)
at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.afterCompletion(SynchronizationCallbackWr
apper.java:74)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:358)
at com.ibm.ws.Transaction.JTA.TransactionImpl.distributeAfter(TransactionImpl.java:3268)
at com.ibm.ws.Transaction.JTA.TransactionImpl.postCompletion(TransactionImpl.java:3312)
at com.ibm.ws.Transaction.JTA.TransactionImpl.internalRollback(TransactionImpl.java:2368)
at com.ibm.ws.Transaction.JTA.TransactionImpl.rollback(TransactionImpl.java:1698)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.rollback(TranManagerImpl.java:274)
at com.ibm.ws.Transaction.JTA.TranManagerSet.rollback(TranManagerSet.java:181)
at com.ibm.ejs.csi.TranStrategy.rollback(TranStrategy.java:911)
at com.ibm.ejs.csi.TranStrategy.handleException(TranStrategy.java:220)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:566)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3798)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3620)
at ejbs.EJSRemoteStatelessValidValueSessionBean_96e1942d.getValidValuesWithCMT(EJSRemoteStatelessVal
idValueSessionBean_96e1942d.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.rmi.util.ProxyUtil$4.run(ProxyUtil.java:727)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:351)
at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:725)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1121)
at $Proxy2.getValidValuesWithCMT(Unknown Source)
at ejbs._ValidValueSessionBean_Stub.getValidValuesWithCMT(_ValidValueSessionBean_Stub.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:65)
at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:111)
at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:370)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:42
1)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:36
7)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
.
java.lang.IllegalStateException: illegal status: 5
at org.jboss.cache.interceptors.TxInterceptor$RemoteSynchronizationHandler.afterCompletion(TxInterce
ptor.java:1019)
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.afterCompletion(TxIntercep
tor.java:1103)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.afterCompletion(OrderedSynchronization
Handler.java:83)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$1.invoke(WebSphereExtendedJTATran
sactionLookup.java:133)
at $Proxy3.afterCompletion(Unknown Source)
at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.afterCompletion(SynchronizationCallbackWr
apper.java:74)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeAfter(RegisteredSyncs.java:358)
at com.ibm.ws.Transaction.JTA.TransactionImpl.distributeAfter(TransactionImpl.java:3268)
at com.ibm.ws.Transaction.JTA.TransactionImpl.postCompletion(TransactionImpl.java:3312)
at com.ibm.ws.Transaction.JTA.TransactionImpl.internalRollback(TransactionImpl.java:2368)
at com.ibm.ws.Transaction.JTA.TransactionImpl.rollback(TransactionImpl.java:1698)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.rollback(TranManagerImpl.java:274)
at com.ibm.ws.Transaction.JTA.TranManagerSet.rollback(TranManagerSet.java:181)
at com.ibm.ejs.csi.TranStrategy.rollback(TranStrategy.java:911)
at com.ibm.ejs.csi.TranStrategy.handleException(TranStrategy.java:220)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:566)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3798)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3620)
at ejbs.EJSRemoteStatelessValidValueSessionBean_96e1942d.getValidValuesWithCMT(EJSRemoteStatelessVal
idValueSessionBean_96e1942d.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.rmi.util.ProxyUtil$4.run(ProxyUtil.java:727)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java:351)
at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:725)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1121)
at $Proxy2.getValidValuesWithCMT(Unknown Source)
at ejbs._ValidValueSessionBean_Stub.getValidValuesWithCMT(_ValidValueSessionBean_Stub.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:65)
at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:111)
at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:370)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:42
1)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:36
7)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
If I used
WebsphereTransactionManagerLookup for WAS6.0 instead of
WebsphereExtendedJTATransactionLookup ( as was suggested in the hibernate manuals) in hibernate.cfg.xml, I do not see the UnsupportedOperationException being thrown. But I do not what the implications of using WebsphereTransactionManagerLookup on WAS6.0 are.