2 Replies Latest reply on May 10, 2012 10:49 AM by Miloud Haimoune

    NullPointerException when loading the ksession  (Unable to load session snapshot)

    Miloud Haimoune Newbie

       

      Hi all,


      I am facing the following issue:

       

      When loading the ksession from the data base (I'm using persisted ksession), after restarting the jboss AS this exception happens:

       

       

       INFO  [ProcessManager] Loading session data ...
      14:14:40,457 ERROR [SingleSessionCommandService] Could not commit session
      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:238)
          at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:191)
          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:101)
          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:84)
      ......
      
      Caused by: java.lang.NullPointerException
          at org.drools.marshalling.impl.InputMarshaller.readActivation(InputMarshaller.java:1000)
          at org.drools.marshalling.impl.InputMarshaller.readActivations(InputMarshaller.java:981)
          at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:281)
          at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:196)
          at org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:93)
          at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:91)
      

       

       

      it happens when jbpm try to unmarshall the filed rulesbytearray (sessionInfo table) when loading the ksession.

       

      I have this issue only when I update the drools or the process definition file (using guvnor) and restart the jboss AS (but not all the time).

       

      I'm working with jbpm 5.2 final and Jboss 5.1 and persisted ksession.

       

       

      Any solution or idea will be very helpful.

       

       

      Thank you.

        • 1. Re: NullPointerException when loading the ksession  (Unable to load session snapshot)
          Miloud Haimoune Newbie

          After doing other tests: updating the process definition and restarting my application (web application using seam and jbpm)  a found an other similar Exception:

           

               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:238)

          at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:191)

           

          ...

           

          Caused by: java.io.EOFException

          at java.io.DataInputStream.readShort(DataInputStream.java:298)

          at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2751)

          at java.io.ObjectInputStream.readShort(ObjectInputStream.java:927)

          at org.jbpm.marshalling.impl.ProcessMarshallerImpl.readProcessTimers(ProcessMarshallerImpl.java:204)

          at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:310)

          at org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:196)

          at org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:93)

          at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:91)

          • 2. Re: NullPointerException when loading the ksession  (Unable to load session snapshot)
            Miloud Haimoune Newbie

            Hi all,

             

            I found a way to solve my issue and load the jbpm session correctly, but I'm still looking for a better solution.

             

            the workaround :  creating a new ksession , KnowledgeBaseFactory.newKnowledgeSessionConfiguration(sessionconfigproperties)

             

            By copying the content of rulesbytearray (sessionInfo table)  of the new created session in the rulesbytearray of old ksession instance that can not be load and  restarting the application, every thing work just fine.

             

            Please if any one think that this can cause an issue or have any other solution, please let me know.

             

             

            Many thanks.