Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-23

"Exception executing consequence for rule" caused by NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • 5.5.0.Final
    • None
    • optaplanner-core
    • None
    • Hide

      Download maven project and run JUnit test ProgramacaoEletronicaSolutionTest.

      Show
      Download maven project and run JUnit test ProgramacaoEletronicaSolutionTest.
    • Hide

      none

      Show
      none
    • Medium

      Hello Guys,
      I'm new to Drools/Planner, I working into a Proof of Concept using Planner to create a feature that solve ship arrival scheduling for our Port Management System.
      Following JBoss Planner documentation:

      • A model was defined: br.gov.serpro.sunac.psp.pes.bean
      • A score function: HARD_AND_SOFT
      • Rule was created: AgendamentoEmBerco.drl
      • Solver was initialized.

      Two tests were implemented:

      • AgendamentoTest simple rule test with no solver. Works fine.
      • ProgramacaoEletronicaSolutionTest test same rule with solver support.

      So, when runnig the ProgramacaoEletronicaSolutionTest I've got a Exception

      Exception executing consequence for rule "Agendamento com colisao de horário para o berço" in br.gov.serpro.sunac.psp.pes.rules: java.lang.NullPointerException
      at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
      at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
      at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
      at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
      at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
      at org.drools.planner.core.solution.director.DefaultSolutionDirector.calculateScoreFromWorkingMemory(DefaultSolutionDirector.java:136)
      at org.drools.planner.core.solver.DefaultSolverScope.calculateScoreFromWorkingMemory(DefaultSolverScope.java:101)
      at org.drools.planner.core.bestsolution.BestSolutionRecaller.solvingStarted(BestSolutionRecaller.java:52)
      at org.drools.planner.core.solver.DefaultSolver.solvingStarted(DefaultSolver.java:156)
      at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:137)
      at br.gov.serpro.sunac.psp.pes.solution.ProgramacaoEletronicaSolutionTest.checkSolver(ProgramacaoEletronicaSolutionTest.java:140)
      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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.NullPointerException

      at br.gov.serpro.sunac.psp.pes.rules.Rule_Agendamento_com_colisao_de_hor_rio_para_o_ber_o.defaultConsequence(Rule_Agendamento_com_colisao_de_hor_rio_para_o_ber_o.java:7)
      at br.gov.serpro.sunac.psp.pes.rules.Rule_Agendamento_com_colisao_de_hor_rio_para_o_ber_oDefaultConsequenceInvoker.evaluate(Unknown Source)
      at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
      ... 36 more

              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              marcospetry_jira Marcos Roberto Petry (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: