1 Reply Latest reply on Nov 2, 2008 11:56 AM by wilson kong

    User Transaction Lookup in Unmanaged Threads

    Thomas Newbie

      Our system is going to migrate from Weblogic 9.1 to Websphere 6.1.19.
      The Websphere application server is running under AIX server.
      JBPM 3.2.1 is used.
      Due to the limitation of the single thread model, I have added multi-threading implementation in each node task action. However, beginTransaction() of Hibernate current session always throws following exception.

      [10/24/08 16:49:19:419 GMT+08:00] 0000002a JTATransactio E org.hibernate.transaction.JTATransaction Could not find UserTransaction in JNDI
      javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:"
      at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1095)
      at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
      at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
      at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
      at javax.naming.InitialContext.lookup(InitialContext.java:363)
      at org.hibernate.transaction.JTATransaction.(JTATransaction.java:60)
      at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:57)
      at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:193)
      at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1315)
      at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1325)
      at org.jbpm.persistence.db.DbPersistenceService.beginTransaction(DbPersistenceService.java:131)
      at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:123)
      at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:336)
      at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
      at com.shkco.adsr3.dayendframework.service.JbpmService.createProcess(JbpmService.java:86)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:128)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:123)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)SystemOut.log (99%)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy5.createProcess(Unknown Source)
      at com.shkco.adsr3.datacentre.service.DayEndTaskListService.startProcess(DayEndTaskListService.java:492)
      at com.shkco.adsr3.datacentre.service.DCDayEndProgressService.startDCDayEndProgress(DCDayEndProgressService.java:214)
      at com.shkco.adsr3.datacentre.activity.StartDCDayEndProgressActivity.perform(StartDCDayEndProgressActivity.java:42)
      at com.shkco.adsr3.framework.ejb.AppControllerBean.handleEvent(AppControllerBean.java:154)
      at com.shkco.adsr3.framework.ejb.EJSRemoteStatelessAppController_9b2df7f6.handleEvent(Unknown Source)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie.handleEvent(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:163)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie._invoke(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:92)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
      at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
      at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
      at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
      at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
      at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
      at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

      [10/24/08 16:49:19:450 GMT+08:00] 0000002a DbPersistence E org.jbpm.persistence.db.DbPersistenceService flushSession hibernate flush failed
      org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
      at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:181)
      at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1867)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:994)
      at org.jbpm.persistence.db.DbPersistenceService.flushSession(DbPersistenceService.java:267)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:231)
      at org.jbpm.svc.Services.close(Services.java:222)
      at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      at com.shkco.adsr3.dayendframework.service.JbpmService.createProcess(JbpmService.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:128)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:123)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy5.createProcess(Unknown Source)
      at com.shkco.adsr3.datacentre.service.DayEndTaskListService.startProcess(DayEndTaskListService.java:492)
      at com.shkco.adsr3.datacentre.service.DCDayEndProgressService.startDCDayEndProgress(DCDayEndProgressService.java:214)
      at com.shkco.adsr3.datacentre.activity.StartDCDayEndProgressActivity.perform(StartDCDayEndProgressActivity.java:42)
      at com.shkco.adsr3.framework.ejb.AppControllerBean.handleEvent(AppControllerBean.java:154)
      at com.shkco.adsr3.framework.ejb.EJSRemoteStatelessAppController_9b2df7f6.handleEvent(Unknown Source)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie.handleEvent(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:163)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie._invoke(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:92)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
      at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
      at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
      at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
      at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
      at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
      at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
      Caused by: java.lang.UnsupportedOperationException
      at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus(WebSphereExtendedJTATransactionLookup.java:78)
      at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:94)
      at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
      at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:159)
      ... 41 more

      [10/24/08 16:49:19:464 GMT+08:00] 0000002a DbPersistence E org.jbpm.persistence.db.DbPersistenceService rollback hibernate rollback failed
      java.lang.NullPointerException
      at org.jbpm.persistence.db.DbPersistenceService.rollback(DbPersistenceService.java:299)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:233)
      at org.jbpm.svc.Services.close(Services.java:222)
      at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      at com.shkco.adsr3.dayendframework.service.JbpmService.createProcess(JbpmService.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:128)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:123)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy5.createProcess(Unknown Source)
      at com.shkco.adsr3.datacentre.service.DayEndTaskListService.startProcess(DayEndTaskListService.java:492)
      at com.shkco.adsr3.datacentre.service.DCDayEndProgressService.startDCDayEndProgress(DCDayEndProgressService.java:214)
      at com.shkco.adsr3.datacentre.activity.StartDCDayEndProgressActivity.perform(StartDCDayEndProgressActivity.java:42)
      at com.shkco.adsr3.framework.ejb.AppControllerBean.handleEvent(AppControllerBean.java:154)
      at com.shkco.adsr3.framework.ejb.EJSRemoteStatelessAppController_9b2df7f6.handleEvent(Unknown Source)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie.handleEvent(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:163)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie._invoke(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:92)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
      at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
      at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
      at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
      at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
      at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
      at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
      org.jbpm.svc.Services close problem closing service 'persistence'
      org.jbpm.persistence.JbpmPersistenceException: hibernate flush failed
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:236)
      at org.jbpm.svc.Services.close(Services.java:222)
      at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      at com.shkco.adsr3.dayendframework.service.JbpmService.createProcess(JbpmService.java:92)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:128)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
      at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
      at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:123)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy5.createProcess(Unknown Source)
      at com.shkco.adsr3.datacentre.service.DayEndTaskListService.startProcess(DayEndTaskListService.java:492)
      at com.shkco.adsr3.datacentre.service.DCDayEndProgressService.startDCDayEndProgress(DCDayEndProgressService.java:214)
      at com.shkco.adsr3.datacentre.activity.StartDCDayEndProgressActivity.perform(StartDCDayEndProgressActivity.java:42)
      at com.shkco.adsr3.framework.ejb.AppControllerBean.handleEvent(AppControllerBean.java:154)
      at com.shkco.adsr3.framework.ejb.EJSRemoteStatelessAppController_9b2df7f6.handleEvent(Unknown Source)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie.handleEvent(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:163)
      at com.shkco.adsr3.framework.ejb._EJSRemoteStatelessAppController_9b2df7f6_Tie._invoke(_EJSRemoteStatelessAppController_9b2df7f6_Tie.java:92)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
      at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
      at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
      at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
      at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
      at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
      at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
      Caused by: org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
      at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:181)
      at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1867)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:994)
      at org.jbpm.persistence.db.DbPersistenceService.flushSession(DbPersistenceService.java:267)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:231)
      ... 37 more
      Caused by: java.lang.UnsupportedOperationException
      at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus(WebSphereExtendedJTATransactionLookup.java:78)
      at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:94)
      at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
      at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:159)
      ... 41 more

      Some settings in the Hibernate configuration for JBPM is shown as below.
      <!-- hibernate dialect -->
      org.hibernate.dialect.Oracle9Dialect
      false
      5
      48
      true
      jta
      org.hibernate.connection.DatasourceConnectionProvider

      org.hibernate.cache.HashtableCacheProvider

      <!-- DataSource properties -->
      jdbc/test

      <!-- JTA transaction properties -->
      java:comp/UserTransaction
      org.hibernate.transaction.JTATransactionFactory
      org.hibernate.transaction.WebSphereExtendedJTATransactionLookup

      I don't have any JNDI transaction lookup problem in Weblogic server but in Websphere. According to the J2EE specification, it states that there is no way to look up user transaction in unmanaged thread. I know Weblogic doesn't strictly follow the specification while Websphere does. Is there any way to solve this problem?