Using shared Gen runtime jar file (genrt.jar) in JBoss EAP
search cancel

Using shared Gen runtime jar file (genrt.jar) in JBoss EAP

book

Article ID: 208442

calendar_today

Updated On:

Products

Gen Gen - Host Encyclopedia Gen - Run Time Distributed Gen - Workstation Toolset

Issue/Introduction

When running the Assemble step for a Gen Java application, the option "Package runtime in EAR" which includes the Gen runtime .jar file in the resulting .ear file should normally be selected to avoid potential install/deployment and execution problems. However, if it is required to deploy a single (maybe customised) version of the Gen runtime .jar file for all applications and not include it in the .ear file, then a workaround is possible using a JBoss global module per details below.

Environment

Release: Gen 8.6
Component: Any type of Gen Java application
Application Server: JBoss EAP 7.1

Resolution

A JBoss Custom Module for the Gen runtime .jar file can be created with other required JBoss module dependencies included and then added as a Global Module for all applications to use. That will resolve both deployment problems and runtime execution problems.
JBoss EAP documentation: Red Hat JBoss Enterprise Application Platform > 7.1 > Configuration Guide > Chapter 6. JBoss EAP Class Loading

For JBoss under Windows using JBoss CLI to create the module gen86_runtime for Gen 8.6 runtime .jar file (genrt.jar) use these steps (commands executed are in bold):
+++
C:\jboss-eap-7.1.0\bin>jboss-cli.bat
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] module add --name=gen86_runtime --resources="C:\Program Files (x86)\CA\Gen86\Gen\classes\genrt.jar" --dependencies=javax.api,javax.xml.bind.api,javax.ejb.api,javax.transaction.api,javax.servlet.api,javax.jms.api
[disconnected /] connect localhost:9990
[standalone@localhost:9990 /] /subsystem=ee:list-add(name=global-modules,value={name=gen86_runtime})
{"outcome" => "success"}
[standalone@localhost:9090/] quit

Press any key to continue . . .

C:\jboss-eap-7.1.0\bin>
+++

NOTE: There are 6 existing JBoss EAP module dependencies specified above that need to be added to ensure no java.lang.NoClassDefFoundError exceptions occur during deployment or runtime:
javax.api
javax.xml.bind.api
javax.ejb.api
javax.transaction.api
javax.servlet.api
javax.jms.api

A directory will be created named JBOSS_INSTALL\modules\gen86_runtime\main which will contain the genrt.jar file and the new module.xml file whose contents are as follows: 
+++
<?xml version='1.0' encoding='UTF-8'?>

<module xmlns="urn:jboss:module:1.1" name="gen86_runtime">

    <resources>
        <resource-root path="genrt.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.xml.bind.api"/>
        <module name="javax.ejb.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api"/>
        <module name="javax.jms.api"/>
    </dependencies>
</module>
+++

No JBoss restart is required after the above change. The deployment and execution of the Java application .ear file will then be successful.

Additional Information

1. The above was tested after creating a genrt.jar file in directory"C:\Program Files (x86)\CA\Gen86\Gen\classes" using the mkjavart.bt file with all options i.e. this command file was used to execute mkjavart.bat:
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_211
mkjavart genrt.jar All AllComms
If a commcfg.properties file is also needed for Gen Java client-server applications then that can also be included using this mkjavart command instead:
mkjavart genrt.jar All AllComms commcfg

2. The required JBoss module dependencies were determined after testing all types of Gen Java application i.e. Web Generation client, Web View client, EJB , EJB Web Service, Java Proxy

3. Related KB article for EJB Web Service under JBoss EAP: Gen EJB Web Service runtimes as a JBoss EAP global module