IBM Support

Unable to reach Rule Execution Server using the EJB3 client API from a remote server

Question & Answer


Question

How do I set the JNDI properties through the Rule Execution Server EJB3 client API?

Cause

The new EJB3 Rule Execution Server remote client API does not provide a way to set JNDI properties programmatically, as the EJB2 API (now deprecated) does (see the IlrRuleSessionProviderFactory API documentation).

The alternative is to use a JNDI property file. However, even when the JNDI properties are correct, errors such as the following one can occur when the client application is running from a server (whether from the same vendor or not) remote to Rule Execution Server:

SystemErr R ilog.rules.res.session.IlrSessionCreationException: An error occurred while the rule session was created.:
javax.naming.NameNotFoundException: Context: TestNode01Cell/nodes/TestNode01/servers/server1, name: ilog.rules.res.session.impl.ejb3.IlrStatelessSessionRemote: First component in name ilog.rules.res.session.impl.ejb3.IlrStatelessSessionRemote not found.
org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0


Moreover, it is not recommended to use JNDI property files in a Java EE container as this could be picked up by other applications and affect their behavior.

Answer

The solution is to bypass the EJB3 IlrSessionFactory API and use the Java EJB API to look up rule sessions directly:


    Properties props = new Properties();
    props.setProperty(Context.PROVIDER_URL, "...");
    props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "...");
    InitialContext context = new InitialContext(props);
    IlrStatelessSession session = (IlrStatelessSession)context.lookup(jndiName);
    ...

After the IlrStatelessSession object is retrieved, use the Rule Execution Server client API as documented.

Starting in the V7.5 version of the product, it is possible again to set JNDI properties through the Rule Execution Server remote client API (see V7.5 IlrEJB3SessionFactory API documentation). Therefore, it is ultimately recommended to upgrade to the latest version (see download document below).

[{"Product":{"code":"SS6MTS","label":"WebSphere ILOG JRules"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modules:Execution Server (BRES \/ RES)","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.1;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21586621