2 Replies Latest reply on Jun 13, 2014 10:13 AM by Ian Ian

    JBPM Transactions fail via im-vm MDB

    Ian Ian Newbie

      Hi,

      I'm looking to see if anyone has experienced the JBPM failing when being called from an MDB but only when that MDB has been invoked in-vm (e.g. via an arquillian test case) as i'm seeing JPA transaction when this edge case happens?

       

      Summary off ies

      • The MDB is setup with CMT
      • The drools-persistence-jpa is wrapped in a User Transaction
      • My other hibernate calls behave as expected and is only the Jbpm code that is failing at this point
      • I'm using 6.1.0.Beta4
      • When calling the code that the MDB calls from my arquillian unit test (i.e. remove the MDB from the test) then the code runs as expected.
      • Code works as expected when called from an external resource (i.e. another resource puts a message onto the queue).
      • Code fails when called from an in-vm hornet-q connection

       

      Before raising an issue I want to be sure this is an issue with drools-persistence-jpa and not misconfiguration on my part

       

      Any thoughts what this could be?


      Thanks,

       

      Ian.

       

      Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:164) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:70) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:39) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.kie.internal.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:121) [kie-internal-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.jbpm.runtime.manager.impl.factory.JPASessionFactory.newKieSession(JPASessionFactory.java:42) [jbpm-runtime-manager-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.jbpm.runtime.manager.impl.PerRequestRuntimeManager.getRuntimeEngine(PerRequestRuntimeManager.java:66) [jbpm-runtime-manager-6.1.0.Beta4.jar:6.1.0.Beta4]
        at com.test.core.jee.ejb.ProcessBean.startProcess(ProcessBean.java:67) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58) [jboss-as-ee-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:129) [jboss-as-weld-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:137) [jboss-as-weld-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58) [jboss-as-ee-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58) [jboss-as-ee-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [jboss-as-ejb3-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ejb3.concurrency.ContainerManagedConcurrencyInterceptor.processInvocation(ContainerManagedConcurrencyInterceptor.java:104) [jboss-as-ejb3-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
        at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104) [jboss-as-ejb3-7.3.3.Final-redhat-SNAPSHOT.jar:7.3.3.Final-redhat-SNAPSHOT]
        ... 153 more
      Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_45]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_45]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_45]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_45]
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:150) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        ... 182 more
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:881) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.drools.persistence.jpa.JpaPersistenceContext.persist(JpaPersistenceContext.java:37) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:103) [drools-persistence-jpa-6.1.0.Beta4.jar:6.1.0.Beta4]
        ... 187 more
      Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:98) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:85) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:96) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.id.enhanced.OptimizerFactory$PooledOptimizer.generate(OptimizerFactory.java:453) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:369) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:117) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:853) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:827) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:831) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:875) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        ... 189 more
      Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@539311ce[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@43b530f1 connection handles=0 lastUse=1402485051921 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@2ca040f1 pool internal context=SemaphoreArrayListManagedConnectionPool@750979f8[pool=jbpmDS] xaResource=LocalXAResourceImpl@7a633564[connectionListener=539311ce connectionManager=4d07a51a warned=false currentXid=null productName=PostgreSQL productVersion=9.2.7 jndiName=java:jboss/jbpmDS] txSync=null]
        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)
        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) [hibernate-core-4.2.7.SP4-redhat-1.jar:4.2.7.SP4-redhat-1]
        ... 206 more
      Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@539311ce[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@43b530f1 connection handles=0 lastUse=1402485051921 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@2ca040f1 pool internal context=SemaphoreArrayListManagedConnectionPool@750979f8[pool=jbpmDS] xaResource=LocalXAResourceImpl@7a633564[connectionListener=539311ce connectionManager=4d07a51a warned=false currentXid=null productName=PostgreSQL productVersion=9.2.7 jndiName=java:jboss/jbpmDS] txSync=null]
        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:604)
        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:467)
        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
        ... 209 more
      Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object
        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:490)
        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:599)
        ... 211 more
      Caused by: java.lang.RuntimeException: Unable to get synchronization
        at org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer.lock(TransactionSynchronizer.java:284)
        at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:227)
        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:483)
        ... 212 more
      Caused by: java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1219) [rt.jar:1.7.0_45]
        at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:340) [rt.jar:1.7.0_45]
        at org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer.lock(TransactionSynchronizer.java:280)
        ... 214 more