Packaging the user web application

You must package the execution stack so that the management web archive (.war file) can actively connect to it. You must use the same data source for both the management and execution stacks.

About this task

To package the execution stack so that the management WAR can actively connect to it, you must install it on the same JMX MBean server and on the same Java™ virtual machine (JVM). To do so, you set the persistence type, package the libraries, copy the web application to the Tomcat webapps directory, and add the appropriate link to the database.

The default ruleset persistence type is file. The Java SE provider does not use a data source and the XU MBean is not activated.

The following procedure covers the Java EE case, when you set the persistence type to datasource. You must use the same data source for both the management and the execution stacks.

Note:

By packaging the engine Java libraries for a business rule application inside a WAR file, you enable multiple applications that useRule Execution Server to coexist in the same JVM.

Procedure

  1. In the ra.xml deployment descriptor, set the ruleset persistence type and activate the XU MBean.

    The ra.xml file is in <InstallDir>/executionserver/bin. You can edit it from any text editor.

    1. Set the ruleset persistence type to datasource.
      <config-property>
         <config-property-name>persistenceType</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
         <config-property-value>datasource</config-property-value>
      </config-property>
      Note:

      By default, the persistence type is the same for Java XOM resources as for rulesets. If you want to change the XOM persistence type, see Changing persistence parameters.

    2. Initialize the data source by setting the persistenceProperties value as in the following example.
      <config-property>
       <config-property-name>persistenceProperties</config-property-name>
       <config-property-type>java.lang.String</config-property-type>
       <config-property-value>JNDI_NAME=jdbc/resdatasource</config-property-value>
      </config-property>
    3. Activate the XU MBean, which is necessary with the management console, by changing the value of the plugins property.
      <config-property>
         <config-property-name>plugins</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
         <config-property-value>{pluginClass=Management,xuName=default},
           {pluginClass=com.ibm.rules.dvs.plugin.IlrExecutionTracePlugin},
           {pluginClass=com.ibm.rules.htds.plugin.WSDLGeneratorPlugin}
         </config-property-value>
      </config-property>
    4. Add the ra.xml file to the WEB-INF/classes directory of your web application.
  2. Package all the libraries for the execution stack in your web application.

    Here is an example that uses an Ant script:

    <import file="${executionserver.home}/lib/classpath-executionserver.xml"/>
    <target name="war">
       <war warfile="myapplication.war" webxml="descriptors/web.xml">
          <!-- Classes of your web application -->
          <classes dir="classes" />
    
          <!-- The ra.xml file configured to use the data source provider -->
          <classes file="descriptors/ra.xml" />
    
          <!-- JAR for the Rule Execution Server in Java SE -->
          <lib dir="${executionserver.home}/lib/">
          <patternset refid="executionserver.j2se.classpath.patternset" />
          </lib>
       </war>
    </target>

    The Ant file executionserver/lib/classpath-executionserver.xml contains the path executionserver.j2se.classpath with the JAR file that is necessary for Java SE execution.

  3. Copy your web application to the <CATALINA_HOME>/webapps directory.
  4. In the <CATALINA_HOME>/conf/server.xml file, add the link to your database for your web application just before the tag that closes the localhost definition </Host>.
    <Context path="/myapplication" 
             docBase="myapplication.war" 
             debug="0" 
             reloadable="true" 
             crossContext="true">
       <Logger className="org.apache.catalina.logger.FileLogger" 
               prefix="localhost_myapplication_log." 
               suffix=".txt" timestamp="true"/>
       <ResourceLink name="jdbc/resdatasource" 
                     global="jdbc/resdatasource" 
                     type="javax.sql.DataSource"/>
    </Context>