[rules-users] removeKnowledgePackage Call Hangs!!

malkhafaji moe.alkhafaji at medcpu.com
Thu May 13 14:44:23 EDT 2010


I am trying to unload a KnowledgePackage that is already loaded in my
KnowledgeBase. The call:

this.knowledgeBase.removeKnowledgePackage(knowledgePackage.getName());

hangs (never returns). I had a similar problem with adding a
KnowledgePackage to a KnowledgeBase and someone on here suggested that there
was a synchronization problem in the internal implementation of the add
method in the KnowledgeBase class, and that problem went away when I
downloaded M1 files (from Feburary 10th of this year). However, I just got
to test the removing of the KnowledgePackage and I seem to have a similar
problem (?).

Here is my unload rule:

rule "MyRule 1.0"
	when
		mpr : MyObject() 
                eval(mpr.isKnowledgeBaseLoaded("ACTIVE_KP"))					
	then 
		mpr.print("Rule MyRule 1.0 Executed");		
		mpr.removeKnowledgeBase("ACTIVE_KP");	
end

The statement "Rule MyRule 1.0 Executed" is printed, and I am able to debug
the code all the way to the line outlined above, and that is when it goes in
a black hole. Any ideas why this is happening? Is this something fixed in
M2? Here is the log:

INFO|11904/0|10-05-13 13:19:54|Exception in thread "Thread-5"
org.drools.runtime.rule.ConsequenceException: rule: MyRule 1.0
INFO|11904/0|10-05-13 13:19:54|
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:981)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:918)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1130)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:739)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:705)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:200)
INFO|11904/0|10-05-13 13:19:54|	at
com.medcpu.mpu.pp.engine.Drools.fireRules(Drools.java:459)
INFO|11904/0|10-05-13 13:19:54|	at
com.medcpu.mpu.MpuExecutor.executeRules(MpuExecutor.java:191)
INFO|11904/0|10-05-13 13:19:54|	at
com.medcpu.mpu.MpuExecutor.initiateRuleExecution(MpuExecutor.java:431)
INFO|11904/0|10-05-13 13:19:54|	at
com.medcpu.mpu.MpuExecutor.propertyChanged(MpuExecutor.java:147)
INFO|11904/0|10-05-13 13:19:54|	at
com.medcpu.mpu.MpuExecutor.run(MpuExecutor.java:498)
INFO|11904/0|10-05-13 13:19:54|	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
INFO|11904/0|10-05-13 13:19:54|	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO|11904/0|10-05-13 13:19:54|	at java.lang.Thread.run(Unknown Source)
INFO|11904/0|10-05-13 13:19:54|Caused by: java.lang.NullPointerException
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.reteoo.RuleTerminalNode.doRemove(RuleTerminalNode.java:369)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.common.BaseNode.remove(BaseNode.java:95)
INFO|11904/0|10-05-13 13:19:54|	at
org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:237)
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/removeKnowledgePackage-Call-Hangs-tp815616p815616.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list