You were not subscribed to the mailing list at the time, so this post did not
make it through to the main list. If you could make a self contained unit
test, we'll fix it asap. Follow details here:
http://docs.jboss.org/drools/release/5.4.0.Final/droolsjbpm-introduction-...
Take a look at MiscTest in drools-compiler to get an idea of how to write
tests.
Mark
ru wrote
Dear drools-users and team!
My working for years code cease to work after switching from Drools
5.3.0Final to 5.4.0Final.
Here is a rule of interest:
..........................................................................
rule "Subscenario-Start"
dialect "java"
when
act: Subscenario( status == "START", $super_run: super_run, $run: run )
then
Scenario scenario = (Scenario) DroolsTab.mapInstance( act.sub_scenario );
scenario.run = new Integer ( runcount.intValue() + 1 );
scenario.super_run = $super_run;
scenario.caller = $run;
scenario.status = "START";
if ( traceLevel.intValue() > 0 )
System.out.println( "STARTING SUB-SCENARIO "+scenario.title+"
"+scenario.run );
Map acm = contexToMap( act.context );
Map scm = contexToMap( scenario.context );
Map rmp = replace( act.ctxmap, acm );
scenario.ctxmap = replace( scm, rmp );
System.out.println( "1" );
if ( act.repeat != null )
{
if ( act.step == null )
act.step = new Integer( 0 );
repeatStep( act, scenario.ctxmap, act.step.intValue() );
}
System.out.println( "2" );
insert( scenario );
System.out.println( "3 "+act.wait_subscenario );
if ( act.wait_subscenario != null && act.wait_subscenario.booleanValue() )
act.status = "REPEAT";
else
act.status = "DONE";
System.out.println( "4 "+act.status );
act.sub_run = scenario.run;
update( act );
System.out.println( "5" );
DroolsTab.getWorkingMemory().setGlobal( "runcount", scenario.run );
System.out.println( "6" );
end
..........................................................................
Here is a trace (Please note: The first time it worked, and the second
gave an error):
..........................................................................
ru@ru-desktop ~ $ DroolsTabScene-5.2/run_protege.sh
WARNING: missing bundle: protege_text -- BundleHelper.
<init>
()
Loaded 5000 instances: Scenario_ProjectKB_Class20011
OpenMap(tm) Version 5.0
Copyright (C) BBNT Solutions LLC. All rights reserved.
See
http://openmap.bbn.com/ for details.
OpenMapTab scenario = ru.oogis.dro.DroolsTab evaluateScript "Run Scenario"
Load time for file:/home/ru/DroolsTabScene-5.2/projects/Sea.pprj = 2 sec
(project) + 1 sec (ui)
DroTimer clock: ru.oogis.util.DroClock < second: 0 >
Run scenario: ru.oogis.dro.DroolsTab evaluateScript "Run Scenario"
FIRE: Start Scenario Command
FIRE: Scenario Null
STARTING SCENARIO s1.Collision 1
FIRE: Scenario Start
start TASK s1.Watch 1
FIRE: Task Start s1.Watch
start ACTION s1.Ports on Map 1
start ACTION s1.Wait Collision 1
FIRE: Interim Action Done s1.Ports on Map
start ACTION s1.Start Cruise from Primorsk 1
STARTING SUB-SCENARIO c1.Cruise from Primorsk 2
1
2
3 false
4 DONE
5
6
FIRE: Interim Action Done s1.Start Cruise from Primorsk
start ACTION s1.Cruise Shift 1
FIRE: Scenario Start
start TASK c1.Cruise from Primorsk 2
FIRE: Task Start c1.Cruise from Primorsk
start ACTION c1.Launch at Primorsk 2
FIRE: Interim Action Done c1.Launch at Primorsk
start ACTION c1.Mooring 2
FIRE: Retract Done Activity c1.Launch at Primorsk
FIRE: Retract Done Activity s1.Start Cruise from Primorsk
FIRE: Retract Done Activity s1.Ports on Map
FIRE: Interim Action Done c1.Mooring
start ACTION Cargo Loading Message 2
FIRE: Interim Action Done Cargo Loading Message
start ACTION c1.Cargo Loading 2 2
FIRE: Retract Done Activity Cargo Loading Message
FIRE: Retract Done Activity c1.Mooring
FIRE: Interim Action Done s1.Cruise Shift
start ACTION s1.Second Cruise 1
STARTING SUB-SCENARIO c1.Cruise to Primorsk 3
1
2
3 true
4 REPEAT
Exception in thread "AWT-EventQueue-0" Exception executing consequence for
rule "Subscenario-Start" in ActionExecutor: java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at org.drools.runtime.rule.StatefulRuleSession$fireAllRules.call(Unknown
Source)
at DroTimer.repeat(Script1.groovy:25)
at ru.igis.omtab.RuNA.repeatSecondActions(RuNA.java:177)
at ru.igis.omtab.Clock.manageClock(Clock.java:82)
at ru.igis.omtab.Clock.actionPerformed(Clock.java:59)
at javax.swing.Timer.fireActionPerformed(Timer.java:313)
at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
at java.awt.EventQueue.access$000(EventQueue.java:96)
at java.awt.EventQueue$1.run(EventQueue.java:608)
at java.awt.EventQueue$1.run(EventQueue.java:606)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Caused by: java.lang.NullPointerException
at
org.drools.core.util.RightTupleIndexHashTable.removeAdd(RightTupleIndexHashTable.java:353)
at org.drools.reteoo.JoinNode.modifyRightTuple(JoinNode.java:212)
at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:531)
at org.drools.reteoo.JoinNode.modifyObject(JoinNode.java:446)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:432)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:157)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:507)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:421)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:314)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:265)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:470)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:370)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:317)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:312)
at
ActionExecutor.Rule_Subscenario_Start_a83c5a15cccb436f8a66818ffd048e7c.defaultConsequence(Rule_Subscenario_Start_a83c5a15cccb436f8a66818ffd048e7c.java:34)
at
ActionExecutor.Rule_Subscenario_Start_a83c5a15cccb436f8a66818ffd048e7cDefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
ActionExecutor.Rule_Subscenario_Start_a83c5a15cccb436f8a66818ffd048e7cDefaultConsequenceInvoker.evaluate(Unknown
Source)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
... 26 more
..........................................................................
Any help would be greatly appreciated.
Sincerely,
Ru
--
View this message in context:
http://drools.46999.n3.nabble.com/Unexpected-java-lang-NullPointerExcepti...
Sent from the Drools: User forum mailing list archive at
Nabble.com.