Hi,
I am trying to start multiple processes parallely using multiple threads (Oracle Database) I am facing the following error:
20:48:37,321 INFO [stdout] (Thread-103) Thread StartedThread-103
20:48:37,325 INFO [stdout] (Thread-104) Thread StartedThread-104
20:48:37,328 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,331 INFO [stdout] (Thread-104) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,334 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,335 WARN [org.hibernate.util.JDBCExceptionReporter] (Thread-104) SQL Error: 0, SQLState: null
20:48:37,342 ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-104) Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@900b93
20:48:37,339 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,346 ERROR [org.drools.persistence.SingleSessionCommandService] (Thread-104) Could not commit session: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not get next sequence value
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.jbpm.persistence.JpaProcessPersistenceContext.persist(JpaProcessPersistenceContext.java:22) [jbpm-persistence-jpa-5.2.0.Final.jar:]
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:43) [jbpm-persistence-jpa-5.2.0.Final.jar:]
at org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154) [jbpm-flow-5.2.0.Final.jar:]
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135) [jbpm-flow-5.2.0.Final.jar:]
at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1079) [drools-core-5.3.1.Final.jar:]
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:306) [drools-core-5.3.1.Final.jar:]
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:119) [drools-core-5.3.1.Final.jar:]
at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:38) [drools-core-5.3.1.Final.jar:]
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-5.3.1.Final.jar:]
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:345) [drools-persistence-jpa-5.3.1.Final.jar:]
at org.drools.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:42) [drools-core-5.3.1.Final.jar:]
at com.l1id.UnitTest.AsynchronousInterceptor.access$0(AsynchronousInterceptor.java:1) [classes:]
at com.l1id.UnitTest.AsynchronousInterceptor$1.run(AsynchronousInterceptor.java:15) [classes:]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_03]
Caused by: org.hibernate.exception.GenericJDBCException: could not get next sequence value
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:646) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:620) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:624) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220) [hibernate-entitymanager-3.4.0.GA.jar:]
... 16 more
Caused by: java.sql.SQLException: Connection is not associated with a managed connection.org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@900b93
at org.jboss.jca.adapters.jdbc.WrappedConnection.lock(WrappedConnection.java:151)
at org.jboss.jca.adapters.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:391)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:145) [hibernate-core-3.3.2.GA.jar:]
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96) [hibernate-core-3.3.2.GA.jar:]
... 25 more
20:48:37,352 INFO [stdout] (Thread-103) Hibernate: select hibernate_sequence.nextval from dual
20:48:37,449 ERROR [stderr] (Thread-104) Exception in thread "Thread-104" javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not get next sequence value
From the logs we observed that only one process is completed and other thread goes into an error state. I am using CommandBasedStatefulKnowledgeSession.
Has any one faced similar issue.
Thanks