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

NotSerializableException when running drools with engine.policy and kie.policy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.1.0.Beta1
    • None
    • None
    • None

      Exception in thread "main" org.optaplanner.benchmark.api.PlannerBenchmarkException: Benchmarking failed: failureCount (1). The exception of the firstFailureSingleBenchmarkRunner (comp01_FIRST_FIT_DECREASING) is chained.
      	at org.optaplanner.benchmark.impl.PlannerBenchmarkRunner.benchmarkingEnded(PlannerBenchmarkRunner.java:204)
      	at org.optaplanner.benchmark.impl.PlannerBenchmarkRunner.benchmark(PlannerBenchmarkRunner.java:86)
      	at org.optaplanner.examples.common.app.CommonBenchmarkApp.buildAndBenchmark(CommonBenchmarkApp.java:29)
      	at org.optaplanner.examples.curriculumcourse.app.CurriculumCourseBenchmarkApp.main(CurriculumCourseBenchmarkApp.java:47)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.lang.RuntimeException: java.io.NotSerializableException: org.drools.core.spi.ReturnValueExpression$SafeReturnValueExpression
      	at org.drools.core.util.ClassUtils.deepClone(ClassUtils.java:460)
      	at org.drools.core.rule.Package.deepCloneIfAlreadyInUse(Package.java:723)
      	at org.drools.core.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:565)
      	at org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:153)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:318)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieBase(KieContainerImpl.java:277)
      	at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieBase(KieContainerImpl.java:272)
      	at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildKieBase(ScoreDirectorFactoryConfig.java:340)
      	at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:282)
      	at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:187)
      	at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:175)
      	at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:145)
      	at org.optaplanner.benchmark.impl.SingleBenchmarkRunner.call(SingleBenchmarkRunner.java:72)
      	at org.optaplanner.benchmark.impl.SingleBenchmarkRunner.call(SingleBenchmarkRunner.java:32)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:724)
      Caused by: java.io.NotSerializableException: org.drools.core.spi.ReturnValueExpression$SafeReturnValueExpression
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.base.accumulators.JavaAccumulatorFunctionExecutor.writeExternal(JavaAccumulatorFunctionExecutor.java:71)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.Accumulate.writeExternal(Accumulate.java:106)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.Pattern.writeExternal(Pattern.java:146)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at java.util.ArrayList.writeObject(ArrayList.java:710)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.GroupElement.writeExternal(GroupElement.java:70)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.Rule.writeExternal(Rule.java:150)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.JavaDialectRuntimeData.writeExternal(JavaDialectRuntimeData.java:135)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at java.util.HashMap.writeObject(HashMap.java:1100)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
      	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.DialectRuntimeRegistry.writeExternal(DialectRuntimeRegistry.java:45)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.rule.Package.writeExternal(Package.java:181)
      	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1456)
      	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
      	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1175)
      	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      	at org.drools.core.util.ClassUtils.deepClone(ClassUtils.java:454)
      	... 18 more
      

      To reproduce:

      Config this run configuration after cloning optaplanner:
      Main class: org.optaplanner.examples.curriculumcourse.app.CurriculumCourseBenchmarkApp
      Vm options: -Xmx1536M -server -Djava.security.manager -Djava.security.policy=/home/gdesmet/tmp/support/edson/security/engine.policy -Dkie.security.policy=/home/gdesmet/tmp/support/edson/security/kie.policy
      working dir: $MODULE_DIR$ (optaplanner-examples)
      

      Weird is that it didn't happen on all datasets. Looks like only on the once where the KieSession was created twice.

              etirelli@redhat.com Edson Tirelli
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: