[
https://issues.jboss.org/browse/JBRULES-3424?page=com.atlassian.jira.plug...
]
Geoffrey De Smet resolved JBRULES-3424.
---------------------------------------
Resolution: Rejected
As the exception message says, the "then" part of that rule has a NPE.
Looking at the drl, it's clear that
global java.util.List resultado
is probably still null at that time.
This issue has therefor been rejected.
There's a different issue to allow using globals in Planner: JBRULES-3329.
"Exception executing consequence for rule" caused by NPE
--------------------------------------------------------
Key: JBRULES-3424
URL:
https://issues.jboss.org/browse/JBRULES-3424
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-planner
Affects Versions: 5.3.0.Final
Environment: Eclipse 3.6.2
JBoss Tools
Java(TM) SE Runtime Environment (build 1.6.0_20-b02) / Java HotSpot(TM) Server VM (build
16.3-b01, mixed mode)
Reporter: Marcos Roberto Petry
Assignee: Geoffrey De Smet
Attachments: ProgramacaoEletronica.zip
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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira