Gen EJB Web Service runtimes as a JBoss EAP global module
search cancel

Gen EJB Web Service runtimes as a JBoss EAP global module

book

Article ID: 206177

calendar_today

Updated On:

Products

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

Issue/Introduction

When running the Assemble step for either just a default EJB Web Service or combined EJB Web Service and Custom Web Service, 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 per details below.

Environment

Release: Gen 8.5, 8.6
Component: Gen EJB Web Services
Application Server: JBoss EAP 7.1

Resolution

Background:
The Custom Web Service is dependent on the default EJB Web Service and will not function without it. That requirement is enforced during the Assemble step where the Custom Web Service can only be assembled if the default EJB Web Service is also selected with it. So the only 2 options are are to deploy the EJB Web Service on its own or deploy both the EJB Web Service with the Custom Web Service i.e. the Custom Web Service cannot be deployed on its own.

Package runtime in EAR
If "Package runtime in EAR" is not selected then the Gen runtime .jar file created in the model.ief\java\deploy.j2ee directory (genrt.jar for Gen 8.6 or genrt.85.jar for Gen 8.5) will not be included in the resulting .ear file and this will cause problems when that file is deployed because the runtime classes are needed to create the Web Service (WSDL etc).
When running the Assemble step for either just a default EJB Web Service or combined default EJB Web Service and Custom Web Service, the attempted deployment to JBoss EAP will fail with this message in the Admin Console because Gen runtime class com.ca.gen.vwrt.IImportView cannot be found:
===
Cannot upload deployment: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"lynnwst.ear\".\"PSTEP1SM.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"PSTEP1SM.jar\" of deployment \"lynnwst.ear\" Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class lynnwst.PSTEP1_Bean with ClassLoader ModuleClassLoader for Module \"deployment.lynnwst.ear.PSTEP1SM.jar\" from Service Module Loader Caused by: java.lang.NoClassDefFoundError: com/ca/gen/vwrt/IImportView Caused by: java.lang.ClassNotFoundException: com.ca.gen.vwrt.IImportView from [Module \"deployment.lynnwst.ear.PSTEP1SM.jar\" from Service Module Loader]"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"lynnwst.ear\".beanmanager"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"lynnwst.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"lynnwst.ear\".beanmanager]"]}
===

The JBoss server.log will also show:
===
2021-01-12 22:08:17,653 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "lynnwst.ear" (runtime-name: "lynnwst.ear")

2021-01-12 22:08:17,679 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0059: Class Path entry ./ in /C:/jboss-eap-7.1.0/bin/content/lynnwst.ear  does not point to a valid jar for a Class-Path reference.
2021-01-12 22:08:17,680 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0207: Starting subdeployment (runtime-name: "PSTEP1SM.jar")
2021-01-12 22:08:17,685 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0059: Class Path entry ./ in /C:/jboss-eap-7.1.0/bin/content/lynnwst.ear/PSTEP1SM.jar  does not point to a valid jar for a Class-Path reference.
2021-01-12 22:08:17,731 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0003: Processing weld deployment lynnwst.ear
2021-01-12 22:08:17,761 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.subunit."lynnwst.ear"."PSTEP1SM.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."lynnwst.ear"."PSTEP1SM.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "PSTEP1SM.jar" of deployment "lynnwst.ear"
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class lynnwst.PSTEP1_Bean with ClassLoader ModuleClassLoader for Module "deployment.lynnwst.ear.PSTEP1SM.jar" from Service Module Loader
 at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
 at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
 at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
 at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
 at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
 ... 5 more
Caused by: java.lang.NoClassDefFoundError: com/ca/gen/vwrt/IImportView
...
Caused by: java.lang.ClassNotFoundException: com.ca.gen.vwrt.IImportView from [Module "deployment.lynnwst.ear.PSTEP1SM.jar" from Service Module Loader]
...
===

Tests conducted by Support have found that by creating a JBoss Custom Module for the Gen runtime .jar file with other required JBoss module dependencies included and adding it as a Global Module for all applications to use will resolve both the deployment problem and any runtime execution problems.
JBoss EAP documentation: Red Hat JBoss Enterprise Application Platform > 7.1 > Configuration Guide - See "Chapter 6. JBoss EAP Class Loading"
Example steps here for JBoss under Windows using JBoss CLI to create the module gen86_runtime for the Gen 8.6 runtime .jar file (genrt.jar) which can be found in the model.ief\java\deploy.j2ee directory after the Assemble step is run:
===
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="FULL_PATH\genrt.jar" --dependencies=javax.api,javax.xml.bind.api,javax.ejb.api,javax.transaction.api
[disconnected /] connect localhost:9990
[standalone@localhost:9990 /] /subsystem=ee:list-add(name=global-modules,value={name=gen86_runtime})
{"outcome" => "success"}

===
Note the 4 existing JBoss EAP module dependencies that need to be added to ensure no further java.lang.NoClassDefFoundError exceptions occur i.e.
javax.api
javax.xml.bind.api
javax.ejb.api
javax.transaction.api


A directory will be created named JBOSS_INSTALL\modules\gen86_runtime\main which will contain the copied 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"/>
    </dependencies>
</module>
+++

No JBoss restart is required after the above change. The deployment and execution of the default EJB Web Service .ear file will then be successful.

Alternatively, the "Package runtime in EAR" option could always be selected during the Assemble of Gen EJB Web Services or Custom Web Services and if it is required to use a custom version of the Gen java runtime .far file then after the Assemble step the .ear file can have its Gen runtime .jar replaced with the custom version before installation on the Application Server.

Additional Information

Other related KB articles:
Using shared Gen runtime jar file (genrt.jar) in JBoss EAP
Gen EJB Web Service runtimes as WebSphere shared library
URL formats for Default & Custom Gen EJB Web Service

Documentation link: 
Gen™ 8.6 > Developing > Designing > Use Gen Studio > Create Custom Proxies and Web Services > Use Custom Web Services