Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-1545

BPMS rule doesn't get fired after modification if using function call.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 6.1.0
    • 6.0.3
    • BRE
    • None

      For a BRMS client application that integrates with Kie API and usage within the client is such that KieRepositoryScanner is registered with KieContainer (with module defined by "LATEST" GAV release id) to periodically check for newer release versions of the KieModule available in remote BRMS knowledge store (business central), download the newer version and automatically update the existing KieContainer used by the client application.

      This works as expected for basic smaller Kie projects consisting of single DRL file containing one or two rules (modifications to LHS rule constraints in new versions of the KieModule were applied automatically when scanner retrieved the new version).

      However, after adding several more rules and several functions to the DRL file, the KieRepositoryScanner dynamic update to the client's existing KieContainer sometimes results in the modified rules or the rules calling modified functions to not fire on subsequent KieSessions.

      After some diggings, the issue seems to be narrowed down to be related to the functions.

      If a rule makes a call to a function then any changes to either the rule or the function will cause the rule to not fire after the kieScanner picks up the modifications.

      One other issue is that if you make a change that removes the call to the function from the rule, you get a NPE error with the stack trace:

      Exception in thread "Timer-0" java.lang.NullPointerException
      at org.drools.core.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:156)
      at org.drools.core.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:1415)
      at org.drools.core.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:1406)
      at org.drools.compiler.compiler.PackageBuilder.preProcessRules(PackageBuilder.java:1146)
      at org.drools.compiler.compiler.PackageBuilder.compileRules(PackageBuilder.java:1089)
      at org.drools.compiler.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:973)
      at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildRules(CompositeKnowledgeBuilderImpl.java:266)
      at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:98)
      at org.drools.compiler.compiler.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:87)
      at org.drools.compiler.kie.builder.impl.KieContainerImpl.rebuildAll(KieContainerImpl.java:302)
      at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:178)
      at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateDependencyToVersion(KieContainerImpl.java:114)
      at org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:231)
      at org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:218)
      at org.kie.scanner.KieRepositoryScannerImpl$ScanTask.run(KieRepositoryScannerImpl.java:198)
      at java.util.TimerThread.mainLoop(Timer.java:555)
      at java.util.TimerThread.run(Timer.java:505)

      The following is the test rule I'm using to show the issues.

      package org.drools.examples.shopping

      import java.lang.Number;
      import java.lang.String;

      function boolean doSomething(String name) {
      System.out.println("Function Called ZZZZZ");
      return true ;
      }

      rule "SecondRule" no-loop
      dialect "java"
      when
      $s : String( )
      eval(doSomething($s))
      then
      System.out.println("Firing Second Rule XXX " + $s);
      end

      The first time after the rule gets compiled and kjar gets installed in local maven repo(or uploaded to business central) everything works fine.

      When the BRMS client application keeps running and a change is made over the rule and a new kjar gets built, for example,
      change
      System.out.println("Firing Second Rule XXX " + $s);
      to
      System.out.println("Firing Second Rule XXXxxx " + $s);
      after the kjar is installed in local maven repo(do "vn clean install" against the kjar project), this rule stop firing any more.

      If a change is made to remove the function call from the rule, for example,
      change
      eval(doSomething($s))
      to
      //eval(doSomething($s))
      after the kjar is installed in maven repo, the NPE error I mentioned above is thrown.

              mfusco@redhat.com Mario Fusco
              rhn-support-ghu Gary Hu
              Marek Winkler Marek Winkler (Inactive)
              Marek Winkler Marek Winkler (Inactive)
              Alessandro Lazarotti, Edson Tirelli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: