Hi,

1. If you want to dynamically update your kbase whenever your resources (DRL, PKG, etc) change, you could use Knowledge Agent. Take a look at the documentation. The KAgent basically makes what you are trying to do. On thing you must to take care (whether you are using KAgent or not) is that whenever you modify a kbase you must rebuild all your sessions (unless they were stateless, of course).

2. Does the package you are trying to remove contains queries definitions? I filled a jira issue some time ago (https://jira.jboss.org/browse/JBRULES-2374) reporting this problem.

Best,

On Thu, Jun 10, 2010 at 9:43 PM, malkhafaji <moe.alkhafaji@medcpu.com> wrote:

Hello,

I have two questions. Hopefully they are very simple:

1. If I wanted to dynamically update a package in the RuleBase because I
found out that the drl was updated on disk, can I just do this:

ruleBase.addPackage(myPackage);

And this will automatically replace (remove the old one, and add the new
one)? Or do I have to implicitly first remove the existing one and THEN add
the modified one again?

I have the following code:

if (ruleBase.getPackage(onePackage.getName()) != null) {
       ruleBase.removePackage(onePackage.getName());
}
ruleBase.addPackage(onePackage);

Is this a code practice to do?

2. My second question is, the statement above in the body of the IF block,
threw the following exception:

Exception in thread "AdminHandler_0_123877285495354"
java.lang.NullPointerException
INFO|7032/0|10-06-10 13:43:55|  at
org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235)
INFO|7032/0|10-06-10 13:43:55|  at
org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413)
INFO|7032/0|10-06-10 13:43:55|  at
org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:729)
INFO|7032/0|10-06-10 13:43:55|  at
org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:657)
INFO|7032/0|10-06-10 13:43:55|  at [statement in the IF block above]

Any ideas why that is?

Thanks.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p887326.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti