Hello,
i'm having an issue with Drools 5.5.0-Final, stateful sessions and persistence to
MySQL.
I have successfully configured and everything seems to work fine (session is persisted
& updated to database), however
sometimes after i kill (not after each kill) and start again application I'm unable to
load back session.
I get this exception when I try to load session:
Hibernate: select sessioninf0_.id as id0_0_,
sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as
rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as
OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:115)
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:83)
at
org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:131)
at lt.mokejimai.ss.engine.Engine.getSession(Engine.java:57)
at lt.mokejimai.ss.engine.Engine.insert(Engine.java:38)
at
lt.mokejimai.ss.api.rest.endpoint.InspectEndpoint.inspectTransactions(InspectEndpoint.java:61)
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.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
at
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:349)
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Thread.java:680)
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.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:100)
... 45 more
Caused by: java.lang.RuntimeException: Unable to load session snapshot
at
org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:96)
at
org.drools.persistence.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:253)
at
org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:195)
... 50 more
Caused by: java.lang.NullPointerException
at
org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:63)
at
org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1034)
at
org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction.<init>(SlidingTimeWindow.java:460)
at
org.drools.marshalling.impl.PersisterHelper.deserializeWorkingMemoryAction(PersisterHelper.java:101)
at
org.drools.marshalling.impl.ProtobufInputMarshaller.readActionQueue(ProtobufInputMarshaller.java:426)
at
org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:260)
at
org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:158)
> at
org.drools.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:117)Hibernate:
select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_,
sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_,
sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as
lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as
startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where
sessioninf0_.id=?
<…>
--
Vytautas Gimbutas