Fixes are available
17.0.0.3: WebSphere Application Server Liberty 17.0.0.3
17.0.0.4: WebSphere Application Server Liberty 17.0.0.4
18.0.0.1: WebSphere Application Server Liberty 18.0.0.1
18.0.0.2: WebSphere Application Server Liberty 18.0.0.2
18.0.0.3: WebSphere Application Server Liberty 18.0.0.3
18.0.0.4: WebSphere Application Server Liberty 18.0.0.4
19.0.0.1: WebSphere Application Server Liberty 19.0.0.1
19.0.0.2: WebSphere Application Server Liberty 19.0.0.2
19.0.0.3: WebSphere Application Server Liberty 19.0.0.3
19.0.0.4: WebSphere Application Server Liberty 19.0.0.4
19.0.0.5: WebSphere Application Server Liberty 19.0.0.5
19.0.0.6: WebSphere Application Server Liberty 19.0.0.6
19.0.0.7: WebSphere Application Server Liberty 19.0.0.7
19.0.0.8: WebSphere Application Server Liberty 19.0.0.8
19.0.0.9: WebSphere Application Server Liberty 19.0.0.9
19.0.0.10: WebSphere Application Server Liberty 19.0.0.10
19.0.0.11: WebSphere Application Server Liberty 19.0.0.11
19.0.0.12: WebSphere Application Server Liberty 19.0.0.12
20.0.0.1: WebSphere Application Server Liberty 20.0.0.1
20.0.0.2: WebSphere Application Server Liberty 20.0.0.2
20.0.0.3: WebSphere Application Server Liberty 20.0.0.3
20.0.0.4: WebSphere Application Server Liberty 20.0.0.4
20.0.0.5: WebSphere Application Server Liberty 20.0.0.5
20.0.0.6: WebSphere Application Server Liberty 20.0.0.6
20.0.0.7: WebSphere Application Server Liberty 20.0.0.7
20.0.0.8: WebSphere Application Server Liberty 20.0.0.8
20.0.0.9: WebSphere Application Server Liberty 20.0.0.9
20.0.0.10: WebSphere Application Server Liberty 20.0.0.10
20.0.0.11: WebSphere Application Server Liberty 20.0.0.11
20.0.0.12: WebSphere Application Server Liberty 20.0.0.12
21.0.0.3: WebSphere Application Server Liberty 21.0.0.3
21.0.0.4: WebSphere Application Server Liberty 21.0.0.4
21.0.0.5: WebSphere Application Server Liberty 21.0.0.5
21.0.0.6: WebSphere Application Server Liberty 21.0.0.6
21.0.0.7: WebSphere Application Server Liberty 21.0.0.7
21.0.0.8: WebSphere Application Server Liberty 21.0.0.8
21.0.0.9: WebSphere Application Server Liberty 21.0.0.9
21.0.0.1: WebSphere Application Server Liberty 21.0.0.1
21.0.0.2: WebSphere Application Server Liberty 21.0.0.2
21.0.0.10: WebSphere Application Server Liberty 21.0.0.10
21.0.0.11: WebSphere Application Server Liberty 21.0.0.11
21.0.0.12: WebSphere Application Server Liberty 21.0.0.12
22.0.0.1: WebSphere Application Server Liberty 22.0.0.1
22.0.0.2: WebSphere Application Server Liberty 22.0.0.2
22.0.0.3: WebSphere Application Server Liberty 22.0.0.3
22.0.0.4: WebSphere Application Server Liberty 22.0.0.4
APAR status
Closed as program error.
Error description
In Liberty application server, with "parentLast" classloading, a ClassCastException is thrown when looking up a remote EJB from the servlet within the same application. This can happen when the application has an EJB module and a web module that both contain a remote interface (or whose classloade both have the remote interface in their class paths). When generating stub class for the remote interface, the web module's classloader should attempt the generation before delegating to it's parent classloader (the application loader). it doesn't, and the application classloader ends up generating and loading the stub class using the remote interface that it loaded - that would then conflict with the remote interface load by the web module loader, resulting in a ClassCastException. This exception could look like this: javax.naming.NamingException: CWNEN1001E: The object referenced by the java:comp/env/ejb/MyEJB JNDI name could not be instantiated. If the reference name maps to a JNDI name in the deployment descriptor bindings for the application performing the JNDI lookup, make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. [Root exception is com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/ejb/MyEJB reference.? The exception message was: Cannot cast class com.ibm.ws.sample.ejb._MyEJBHome_Stub to interface com.ibm.ws.sample.ejb.MyEJB]
Local fix
1 - remove EJB module from WAR module ClassPath 2 - generate EJB Stubs with createEJBStubs command and include in the EJB module (then ClassGenerator would not be used)
Problem summary
**************************************************************** * USERS AFFECTED: All users of IBM WebSphere Application * * Server Liberty - Runtime and Classloading * **************************************************************** * PROBLEM DESCRIPTION: ClassCastException thrown when using * * remote EJBs in servlet with parent-last * * classloading * **************************************************************** * RECOMMENDATION: * **************************************************************** In Liberty application server, with "parentLast" classloading, a ClassCastException is thrown when looking up a remote EJB from the servlet within the same application. This can happen when the application has an EJB module and a web module that both contain a remote interface (or whose classloader both have the remote interface in their class paths). When generating stub class for the remote interface, the web module's classloader should attempt the generation before delegating to it's parent classloader (the application loader). It doesn't, and the application classloader ends up generating and loading the stub class using the remote interface that it loaded - that would then conflict with the remote interface load by the web module loader, resulting in a ClassCastException. This exception could look like this: javax.naming.NamingException: CWNEN1001E: The object referenced by the java:comp/env/ejb/MyEJB JNDI name could not be instantiated. If the reference name maps to a JNDI name in the deployment descriptor bindings for the application performing the JNDI lookup, make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. [Root exception is com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/ejb/MyEJB reference.? The exception message was: Cannot cast class com.ibm.ws.sample.ejb._MyEJBHome_Stub to interface com.ibm.ws.sample.ejb.MyEJB]
Problem conclusion
The fix for this APAR is to ensure that stubs are generated in the current classloader before delegating to the parent when the parentLast delegation policy is in effect. The fix for this APAR is currently targeted for inclusion in fix pack 17.0.0.3. Please refer to the Recommended Updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PI83439
Reported component name
WAS LIBERTY COR
Reported component ID
5725L2900
Reported release
855
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2017-06-21
Closed date
2017-08-14
Last modified date
2017-08-14
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
WAS LIBERTY COR
Fixed component ID
5725L2900
Applicable component levels
R855 PSY
UP
Document Information
Modified date:
03 May 2022