Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1718

ClassCastException when serializing session

XMLWordPrintable

    • False
    • False
    • CR1
    • CR2
    • Undefined
    • Hide

      Please run the reproducer from the attached PR inside drools/drools-persistence/drools-persistence-jpa:

      mvn clean test -Dtest=JpaPersistentStatefulSessionTest
      
      Show
      Please run the reproducer from the attached PR inside drools/drools-persistence/drools-persistence-jpa : mvn clean test -Dtest=JpaPersistentStatefulSessionTest
    • 2021 Week 16-18 (from Apr 19)

      Serialization of a specific KieSession fails due to the following ClassCastException (triggered by using a KieSession with persistence):

      java.lang.ClassCastException: class java.lang.String cannot be cast to class org.drools.core.reteoo.AccumulateNode$AccumulateContext (java.lang.String is in module java.base of loader 'bootstrap'; org.drools.core.reteoo.AccumulateNode$AccumulateContext is in unnamed module of loader 'app')
      	at org.drools.core.common.PhreakActivationIterator.collectFromPeers(PhreakActivationIterator.java:219)
      

      The complete stack trace follows:

      [ERROR] testFamilyRulesSerialization[pessimistic](org.drools.persistence.kie.persistence.session.JpaPersistentStatefulSessionTest)  Time elapsed: 0.264 s  <<< ERROR!
      java.lang.RuntimeException: Unable to commit transaction
      	at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:249)
      	at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:611)
      	at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:568)
      	at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:400)
      	at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:68)
      	at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:37)
      	at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:41)
      	at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:544)
      	at org.drools.persistence.kie.persistence.session.JpaPersistentStatefulSessionTest.testFamilyRulesSerialization(JpaPersistentStatefulSessionTest.java:568)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:27)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
      Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
      	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1300)
      	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
      	at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:246)
      	... 46 more
      Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class org.drools.core.reteoo.AccumulateNode$AccumulateContext (java.lang.String is in module java.base of loader 'bootstrap'; org.drools.core.reteoo.AccumulateNode$AccumulateContext is in unnamed module of loader 'app')
      	at org.drools.core.common.PhreakActivationIterator.collectFromPeers(PhreakActivationIterator.java:219)
      	at org.drools.core.common.PhreakActivationIterator.collectFromLeftInput(PhreakActivationIterator.java:212)
      	at org.drools.core.common.PhreakActivationIterator.collectFromPeers(PhreakActivationIterator.java:226)
      	at org.drools.core.common.PhreakActivationIterator.collectFromLeftInput(PhreakActivationIterator.java:212)
      	at org.drools.core.common.PhreakActivationIterator.collectFromPeers(PhreakActivationIterator.java:226)
      	at org.drools.core.common.PhreakActivationIterator.collectFromLeftInput(PhreakActivationIterator.java:212)
      	at org.drools.core.common.PhreakActivationIterator.collectFromPeers(PhreakActivationIterator.java:226)
      	at org.drools.core.common.PhreakActivationIterator.collectFromLeftInput(PhreakActivationIterator.java:212)
      	at org.drools.core.common.PhreakActivationIterator.lambda$processLeftTuples$0(PhreakActivationIterator.java:204)
      	at org.drools.core.common.DefaultFactHandle$SingleLinkedTuples.forEachLeftTuple(DefaultFactHandle.java:739)
      	at org.drools.core.common.DefaultFactHandle.forEachLeftTuple(DefaultFactHandle.java:935)
      	at org.drools.core.common.PhreakActivationIterator.processLeftTuples(PhreakActivationIterator.java:202)
      	at org.drools.core.common.PhreakActivationIterator.collectAgendaItems(PhreakActivationIterator.java:112)
      	at org.drools.core.common.PhreakActivationIterator.<init>(PhreakActivationIterator.java:63)
      	at org.drools.core.common.PhreakActivationIterator.iterator(PhreakActivationIterator.java:70)
      	at org.drools.core.common.ActivationIterator.iterator(ActivationIterator.java:62)
      	at org.drools.serialization.protobuf.ProtobufOutputMarshaller.writeAgenda(ProtobufOutputMarshaller.java:333)
      	at org.drools.serialization.protobuf.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:159)
      	at org.drools.serialization.protobuf.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:117)
      	at org.drools.serialization.protobuf.ProtobufMarshaller.marshall(ProtobufMarshaller.java:123)
      	at org.drools.serialization.protobuf.ProtobufMarshaller.marshall(ProtobufMarshaller.java:107)
      	at org.drools.persistence.api.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:78)
      	at org.drools.persistence.info.SessionInfo.transform(SessionInfo.java:98)
      	at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:61)
      	at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:54)
      	at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
      	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:360)
      	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
      	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
      	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1288)
      	... 48 more
      

      This is a regression from 7.10.1.

              mfusco@redhat.com Mario Fusco
              mwinkler@redhat.com Marek Winkler (Inactive)
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: