Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-376

NullPointerException on JPAKnowledgeService.loadStatefulKnowledgeSession() when Collection is modified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.1.Final
    • 6.0.0.Final
    • None
    • None

      • Using JPAKnowledgeService
      • Add two or more elements to Collection property which is referred by 'from' in a rule.
      package org.drools.test
      import org.drools.compiler.Person
      import org.drools.compiler.Address
      rule rule1
      when
       $p: Person($list : addresses)
       $a: Address(street == "y") from $list
      then
       $list.add( new Address("z") );
       $list.add( new Address("w") );
      end
      
      • Call JPAKnowledgeService.loadStatefulKnowledgeSession()

      Then NullPointerException is thrown

      2013-12-12 18:03:31,329 [main] |org.drools.persistence.SingleSessionCommandService| WARN  Could not commit session
      java.lang.RuntimeException: Unable to load session snapshot
      	at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:88) ~[classes/:na]
      	at org.drools.persistence.SingleSessionCommandService.initExistingKnowledgeSession(SingleSessionCommandService.java:264) ~[classes/:na]
      	at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:196) ~[classes/:na]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.7.0_13]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [na:1.7.0_13]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [na:1.7.0_13]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [na:1.7.0_13]
      	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:101) [classes/:na]
      	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:84) [classes/:na]
      	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:1) [classes/:na]
      	at org.kie.internal.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:130) [kie-internal-6.1.0-SNAPSHOT.jar:6.1.0-SNAPSHOT]
      	at org.drools.persistence.session.JpaPersistentStatefulSessionTest.testFromNodeWithModifiedCollection(JpaPersistentStatefulSessionTest.java:562) [test-classes/:na]
      ...
      Caused by: java.lang.NullPointerException: null
      	at org.drools.core.reteoo.FromNode.createRightTuple(FromNode.java:152) ~[classes/:na]
      	at org.drools.core.phreak.PhreakFromNode.doLeftInserts(PhreakFromNode.java:96) ~[classes/:na]
      	at org.drools.core.phreak.PhreakFromNode.doNode(PhreakFromNode.java:49) ~[classes/:na]
      	at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:348) ~[classes/:na]
      	at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:161) ~[classes/:na]
      	at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116) ~[classes/:na]
      	at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:200) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufInputMarshaller$PBActivationsFilter.fireRNEAs(ProtobufInputMarshaller.java:813) ~[classes/:na]
      	at org.drools.core.reteoo.LeftInputAdapterNode.doInsertObject(LeftInputAdapterNode.java:258) ~[classes/:na]
      	at org.drools.core.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:199) ~[classes/:na]
      	at org.drools.core.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:60) ~[classes/:na]
      	at org.drools.core.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:288) ~[classes/:na]
      	at org.drools.core.reteoo.EntryPointNode.assertObject(EntryPointNode.java:260) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufInputMarshaller.assertHandleIntoOTN(ProtobufInputMarshaller.java:499) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readFactHandles(ProtobufInputMarshaller.java:476) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:250) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:157) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:116) ~[classes/:na]
      	at org.drools.core.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:1) ~[classes/:na]
      	at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:83) ~[classes/:na]
      

              mfusco@redhat.com Mario Fusco
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: