Problem with JPAKnowledgeService.loadStatefulKnowledgeSession
jjsaguit Dec 12, 2013 2:57 AMHello guys,
I am trying to load my session from the db using JPAKnowledgeService.loadStatefulKnowledgeSession. Here's how I did it:
UserTransaction ux = (UserTransaction)new InitialContext().lookup("java:jboss/UserTransaction"); ux.begin(); System.out.println("param approve "+ param.toString()); ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(param.getInt("ProcessID"), kbase, null, env); System.out.println("got ksession"); ksession.getWorkItemManager().registerWorkItemHandler("HumanTask",new ProcessHandler(ksession.getId())); //complete the task ksession.getWorkItemManager().completeWorkItem(param.getInt("TaskID"), null); System.out.println("got workitemId"); ux.commit();
And this is the output that I got:
15:24:21,834 INFO [stdout] (queue dispatcher thread) param approve {"ReturnValue":0,"ProcessID":7859,"TaskID":8385,"isApproved":true} 15:24:21,846 INFO [stdout] (queue dispatcher thread) Hibernate: select sessioninf0_.id as id41_0_, sessioninf0_.lastModificationDate as lastModi2_41_0_, sessioninf0_.rulesByteArray as rulesByt3_41_0_, sessioninf0_.startDate as startDate41_0_, sessioninf0_.OPTLOCK as OPTLOCK41_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=? 15:24:21,869 ERROR [org.drools.persistence.SingleSessionCommandService] (queue dispatcher thread) Could not commit session: java.lang.RuntimeException: Unable to load session snapshot at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:96) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:253) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:195) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_17] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_17] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17] at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17] at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:100) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:83) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:131) [knowledge-api-5.5.0.Final.jar:5.5.0.Final] at com.softskills.queue.Workflow.startWorkflow(Workflow.java:117) [classes:] at com.softskills.queue.QueueReceiverBean$QueuePoll$1.run(QueueReceiverBean.java:119) [classes:] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17] Caused by: java.lang.NullPointerException at org.mvel2.DataConversion.convert(DataConversion.java:129) [mvel2-2.1.3.Final.jar:] at org.mvel2.ast.TypeCast.getReducedValueAccelerated(TypeCast.java:74) [mvel2-2.1.3.Final.jar:] at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) [mvel2-2.1.3.Final.jar:] at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123) [mvel2-2.1.3.Final.jar:] at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119) [mvel2-2.1.3.Final.jar:] at org.mvel2.MVEL.executeExpression(MVEL.java:942) [mvel2-2.1.3.Final.jar:] at org.drools.base.dataproviders.MVELDataProvider.getResults(MVELDataProvider.java:111) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:145) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:154) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.marshalling.impl.ProtobufInputMarshaller.assertHandleIntoOTN(ProtobufInputMarshaller.java:477) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.marshalling.impl.ProtobufInputMarshaller.readFactHandles(ProtobufInputMarshaller.java:453) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:255) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:158) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:117) [drools-core-5.5.0.Final.jar:5.5.0.Final] at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:91) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final] ... 12 more 15:24:22,106 INFO [stdout] (queue dispatcher thread) error: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
Here's my session table:
And here's my task table:
I'm sure the my data was persisted since Its on the table, don't know why there are some null on the timestamps though
I can't seem to retrieve the session and as you can see I've reached 7k+ tests
Any Idea where's the problem here? I'm totally stuck, any help would be greatly appreciated
Thanks!
Using jbpm 5.4