Hi list,
I have a very simple webapp demo based on drools-persistence-jpa.
I can obtain a StatefulKnowledgeSession from this statement:
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(this.kbase, null, env);
and the SessionInfo will be stored into database correctly, except that the rulesByteArray field is always empty.
Then I use the following statement to retrieve this ksession, but NPE occurred.
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(
command.getSessionId(), this.kbase, null, env);
I've read the code (JPASessionMarshallingHelper.loadSnapshot()) and find that this should be caused by the empty rulesByteArray filed.
I'm wondering in which case this field is empty, and how to make it work correct.
Below is the stacktrace:
Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:110)
at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:78)
at org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:118)
at com.zyeeda.framework.knowledge.internal.DroolsKnowledgeServiceProvider.execute(DroolsKnowledgeServiceProvider.java:165)
at $KnowledgeService_12c173f2df7.execute($KnowledgeService_12c173f2df7.java)
at com.zyeeda.framework.resources.SampleFlowResource.start(SampleFlowResource.java:36)
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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
... 49 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:95)
... 60 more
Caused by: java.lang.NullPointerException
at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
at org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:85)
at org.drools.persistence.session.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:196)
at org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:159)
Thank you very much!
--
唐睿