mayank sahai [
https://community.jboss.org/people/mesa] created the discussion
"Jbpm 5.4: testing user group assignment using JbpmJunitTestCase"
To view the discussion, visit:
https://community.jboss.org/message/799618#799618
--------------------------------------------------------------
i am trying to Unit test user group assignment by extending JbpmJunitTestCase but
encountering one exception.
i am setting up the test :
public MytTest() {
super(true);
setPersistence(true);
} -------------- this results in Exception being thrown ,
5591 INFO - UserGroupCallback registered from system property:
org.jbpm.task.identity.DefaultUserGroupCallbackImpl
5591 INFO - UserGroupCallback registered:
org.jbpm.task.identity.DefaultUserGroupCallbackImpl
5601 WARN - executing transaction with 0 enlisted resource
5691 ERROR - Could not commit session
org.jbpm.workflow.instance.WorkflowRuntimeException: [com.mayank.training.management:1 -
EnterTraining:2] -- IOException while storing workItem 1:
com.mayank.training.core.model.Training
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at
org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
at
org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
at
org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)
at
org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:194)
at
org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:309)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:170)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:140)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1082)
at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:320)
at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:120)
at
org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:39)
at
org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at
org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:367)
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)
at
com.mayank.training.jbpm.TrainingManagementTest.testHumanTaskAssignedToSalesGroup(TrainingManagementTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.jbpm.test.KnowledgeSessionCleanup$1.evaluate(KnowledgeSessionCleanup.java:28)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: IOException while storing workItem 1:
com.mayank.training.core.model.Training
at org.drools.persistence.info.WorkItemInfo.update(WorkItemInfo.java:140)
at
org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:46)
at
org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:107)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
... 45 more
5691 INFO - closing
7881 ERROR - Could not commit session
java.lang.RuntimeException: Could not find session data for id 1
at
org.drools.persistence.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:226)
at
org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:350)
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.dispose(CommandBasedStatefulKnowledgeSession.java:241)
at org.jbpm.test.KnowledgeSessionCleanup$1.evaluate(KnowledgeSessionCleanup.java:38)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC
datasource named jdbc/jbpm-ds
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:92)
at
bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:250)
at
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
at
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
at
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
at
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
at
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at
org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:614)
at
org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:589)
at
org.drools.persistence.jpa.JpaPersistenceContext.findSessionInfo(JpaPersistenceContext.java:21)
at
org.drools.persistence.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:224)
... 19 more
Caused by: bitronix.tm.recovery.RecoveryException: cannot start recovery on a
PoolingDataSource containing an XAPool of resource jdbc/jbpm-ds with 0 connection(s) (0
still available)
at
bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:288)
at bitronix.tm.recovery.IncrementalRecoverer.recover(IncrementalRecoverer.java:61)
at bitronix.tm.resource.ResourceRegistrar.register(ResourceRegistrar.java:87)
at
bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:104)
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:88)
... 43 more
Caused by: java.sql.SQLException: unable to connect to non-XA resource org.h2.Driver
at
bitronix.tm.resource.jdbc.lrc.LrcXADataSource.getXAConnection(LrcXADataSource.java:108)
at
bitronix.tm.resource.jdbc.PoolingDataSource.createPooledConnection(PoolingDataSource.java:341)
at bitronix.tm.resource.common.XAPool.createPooledObject(XAPool.java:283)
at bitronix.tm.resource.common.XAPool.grow(XAPool.java:391)
at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:371)
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:123)
at
bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:284)
... 47 more
Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken:
"java.net.ConnectException: Connection refused: connect: localhost" [90067-161]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:377)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:267)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at
bitronix.tm.resource.jdbc.lrc.LrcXADataSource.getXAConnection(LrcXADataSource.java:104)
... 53 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at org.h2.util.NetUtils.createSocket(NetUtils.java:110)
at org.h2.util.NetUtils.createSocket(NetUtils.java:91)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:91)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:373)
... 58 more
p.f.a. persistence.xml attached, it appears to me a configuration issue but unable to find
any answer on web.
i am able to test process flow without using persistence.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/799618#799618]
Start a new discussion in jBPM Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]