Gen Java application java.lang.NoClassDefFoundError for component class
search cancel

Gen Java application java.lang.NoClassDefFoundError for component class

book

Article ID: 374833

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed Gen - Workstation Toolset

Issue/Introduction

Having issues with Gen 8.6 EJB application that is generated from the consuming model that consumes sub-transactional public operations/components.

Followed the steps provided in the docs: Component Based Development in Java

However at runtime receive an exception:

TIRM030E: Application failed - Updates have been backed out
CSU-GENERAL-ERROR: WsErrorParser::parse(): ERROR PSTEP1_NAME@0000000005,0039071670,0 63 [  AE/0] Invoke Action Block  jpname.PSTEP1.PSTEP1( jpname.PSTEP1_IA, jpname.PSTEP1_OA)  failed: Exception on method: PSTEP1 : java.lang.NoClassDefFoundError: jpname/COMP1_IA (faultcode:soapenv:Server).

In the WebSphere JVM log it is:

[8/14/24 7:05:24:290 SAST] 0000012c SystemOut     O 08/14/24-07:05:24:288[WebContainer : 0]: EJBProcedureStepContext.getInstance(): Class.forName(jpname.COMP_IA) failed
[8/14/24 7:05:24:291 SAST] 0000012c SystemOut     O 08/14/24-07:05:24:291[WebContainer : 0]: java.lang.ClassNotFoundException: jpname.COMP1_IA
        at java.lang.Class.forNameImpl(Native Method)
        at java.lang.Class.forName(Class.java:410)
        at com.ca.gen.ejb.EJBProcedureStepContext.getInstance(Unknown Source)
        at jpname.PSTEP1.f_39075496(Unknown Source)
        at jpname.PSTEP1.f_39071670(Unknown Source)

"jpname" is the Model level Java Package Name in the Consuming model.

The .ear file has been provided which contains the EJB and the separate .jar file for the components.

Environment

Gen Component Based Development for Java.

Resolution

Root cause appears to be package name mismatch between the calling EJB class PSTEP1 and the consumed sub-transactional component import view class COMP1_IA.
The calling class in the error is PSTEP1 which is in package jpname and the error indicates it is trying to call COMP1_IA using the same package name.
However from the .ear file provided the package name levels in the lib/.jar file for the components indicates that the COMP1 package name is com.dummy.services.

Per the doc. reference: Component Based Development in Java

***
Package Name Settings
To allow components to be easily consumed, the following package name settings are recommended:

  • In the implementation model, define a Package Name at the Model Level.

  • In the consuming model, import the spec model into its own Business System and set its package name to that of the implementation model.

***
NOTE: The Java Package Name can be set at Business System level under the Environment parameters.
That Business System level value will override both any Java Package Name value set at Model level in Model Generation Properties (Generation > Options) or any default selected by the generator if the Model level value is not set. 

In the consuming model after setting the COMP1 component Business System Java Package Name to com.dummy.services and regenerating the EJB code, all the components were called with the correct package name so the runtime problem was resolved.