[rules-users] when to use RuleBase.removePackage()

Michael Neale michael.neale at gmail.com
Tue Jan 30 23:24:50 EST 2007


Hi Justine.

Normally in your case, just load up a fresh RuleBase from the drl(s), and
use it from then on (calling newWorkingMemory()) as needed.

You wouldn't normally remove the package before adding it - adding it should
modify the network (by merging the packages, at least I think).

In your case though, doing the former is probably what you want.

On 1/31/07, Justine Hlista <justine at vsasset.com> wrote:
>
> Hello,
>
> Suppose I have a drl file(s) that defines a rules package. I have loaded
> this into the rule base. At runtime however, my user may change the file(s)
> that defines the package. Do I need to call RuleBase.removePackage ()
> before adding the newly modified drl code? Or will the rule base
> automatically update all the modified rules correctly?
>
> When I call removePackage, I get the following exception, but I'm not sure
> why...
>
> Warning: An error occurred compiling a semantic invoker. Errors should
> have been reported elsewhere.
> Exception in thread "main" java.lang.NullPointerException
>     at org.drools.reteoo.ReteooBuilder.removeRule (Unknown Source)
>     at org.drools.reteoo.ReteooRuleBase.removeRule(Unknown Source)
>     at org.drools.common.AbstractRuleBase.removePackage(Unknown Source)
>     at com.vsasset.rules.dynamic.RemovePkgTestCase.replaceRuleFile (
> RemovePkgTestCase.java:58)
>     at com.vsasset.rules.dynamic.RemovePkgTestCase.testLoad1AssertLoad2(
> RemovePkgTestCase.java:38)
>     at com.vsasset.rules.dynamic.RemovePkgTestCase.main(
> RemovePkgTestCase.java:23)
>     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:585)
>     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>
> Process finished with exit code 1
>
>
> Thanks!
> Justine
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070131/d5b4a66c/attachment.html 


More information about the rules-users mailing list