Referencing and deploying ILOG jrules jars within XOM of an IBM ODM rule

521 Views Asked by At

I am working on implementation of some logic with cascading rules execution on IBM ODM. I was pretty much following these instructions from documentation. Namely, I wrote some simple logic invoking one ruleset from another, using library class and referenced two jar files: jrules-res-8.10.5.1-execution.jar and jrules-res-8.10.5.1-session-java.jar. Which I've taken from local ODM installation and referenced them in eclipse via .classpath of a XOM project like that:

    <classpathentry kind="var" path="ILOG_BR_HOME/WEB-INF/lib/jrules-res-8.10.5.1-session-java.jar"/>

Classpath variable ILOG_BR_HOME points to a local folder with required jars.

The documentation states that I need to exclude the two jars from export, which I did. The problem, however, occurred when I tried to deploy updated ruleset to an instance of ODM. I exported an archive of all projects (xom with jar files and updated boms) and imported it via web interface of the decision center. The import was successful and, for instance, verbalization of new items was accessible via web editor of action rules. However, I received the following errors upon deployment:

errorilog.rules.teamserver.brm.builder.IlrBuildException:     While applying business to execution (B2X) model mapping
GBREX0033E: Cannot load execution class 'io.cascadingruletest.RulesetChildRunner' for translating business class 'io.cascadingruletest.RulesetChildRunner', got '[java.lang.NoClassDefFoundError: ilog.rules.res.session.config.IlrSessionFactoryConfig]'
GBREX0001E: Cannot find execution class 'ilog.rules.res.session.IlrSessionException' for translating business class 'ilog.rules.res.session.IlrSessionException'
GBREX0033E: Cannot load execution class 'io.cascadingruletest.contracts.ValueContext' for translating business class 'io.cascadingruletest.contracts.ValueContext', got '[java.lang.NoClassDefFoundError: ilog.rules.res.session.IlrSessionException]'

From what I gather it means that referenced jars are not accessible for deployment. I tried various ways of deploying, putting jars directly in the xom archives, or in the root of archive to be imported, with the same results. Having tried to find documentation on how exactly linking should be done in this situation, I have to admit I am confused and don't understand some principles here:

  1. Should jrules* jars be present inside a zip archive of xom? Or are they already a part of installation and should simply be referenced properly? (I checked the same jars I have locally are also present inside a remote instance of ODM I was deploying to) Or maybe they should be deployed separately?
  2. What is the preferred way of linking external (and internal) libraries in order to invoke them in XOM of a rule? Having looked through some examples in documentation and github, I've encountered several ways:
  • a. Via .classpath file (see my example below or gh example)

  • b. Via .ruleproject file:

<entries xsi:type="ilog.rules.studio.model.xom:SystemXOMPathEntry" name="jrules-teamserver.jar" url="file:C:/Program Files/IBM/ODM8104/teamserver/lib/jrules-teamserver.jar" exported="true"/>

Taken from here

  • c. Reference in a deploy ant script with res-deploy-xom task:
<target name="runloanvalidation">
        <res-deploy-xom
            hostname="localhost"
            portnumber="9080"
            webapp="res"
            userid="resAdmin"
            password="resAdmin"
            jarMajorVersion="false"
            libName="person"
            outputRulesetProperty="ruleset.managedxom.uris">
            <xompath>
            <fileset dir="hello">
                <include name="*.jar"/>
            </fileset>
            </xompath>
        </res-deploy-xom>
        <echo message="Resulting property: ${ruleset.managedxom.uris}"/>
    </target>

Taken from documentation. I do not have an ant script for deployment at the moment, and I've been deploying previously using either eclipse to sync with decision center or via exporting zip and importing it using web interface at an ODM instance.

  • d. Referenced as an external jars and libraries using explorer tab of Rule Execution Server console via Add Library Reference button
  1. If jrules jar files are already present at an instance of ODM and should simply be referenced properly, what are the ways to check the relative paths and list all accessible libraries? And do I need to grant specific rights and privileges to make such a references?

Thanks in advance for your help!

PS I am using 8.10.5.1 version of ODM decision center and eclipse as an IDE with a rule designer plugin.

1

There are 1 best solutions below

0
On

The RulesetChildRunner that is mentioned in the documentation is an interesting way to cascade ruleset executions. However, it is a bit complex to use.

If you have a simple use case and you can handle your own rule project dependencies, I would suggest to create a top rule project that orchestrate the sequence of the 2 main ruleflows you want to cascade.

That would be simpler to manage than to create custom code.

If you need to pass parameters from decisionoperation1 to the decisionoperation2 ruleset, you can do that using a bal rule to initialize parameter_ruleset2 from parameter (or_xom) info from the ruleset1.

Hope this helps,

Best

Emmanuel