EAP 7.4 jboss-client.jar throws NoClassDefFoundError
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.4 Update 8
- 7.4 Update 7
Issue
With EAP 7.4.7 the contained jboss-client.jar now throws a NoClassDefFoundError when a remote EJB is called.
It is my understanding the jboss-client.jar should be a complete in itself fat jar for an EJB client that does not require further dependencies.
Our reproducer generates the following Stacktrace:
.. ..
INFO: JBoss EJB Client version 4.0.45.Final-redhat-00001
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoadException
at org.jboss.ejb.client.EJBClientContext.getDefault(EJBClientContext.java:110)
at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:286)
at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:861)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:165)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:116)
at com.sun.proxy.$Proxy3.sayHello(Unknown Source)
at test.EJBClient.main(EJBClient.java:22)
Caused by: java.lang.ClassNotFoundException: org.jboss.modules.ModuleLoadException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 7 more
.. ..
Resolution
Apply EAP 7.4 Update 9+
As a workaround for JBoss EAP 7.4 Update 7 / Update 8, add jboss-modules.jar copied from JBOSS_EAP_747_HOME/jboss-modules.jar to the classpath of the standalone remote EJB client application:
$ java -cp jboss-modules.jar:jboss-client.jar:standalone-ejbclient-app.jar org.example.ejb.MyClient
Root Cause
This content is not included.JBEAP-24148
A change came into effect with EJB Client v 4.0.45. which JBoss Modules had been referencing for a long time.
[1] Content from github.com is not included.Content from github.com is not included.https://github.com/wildfly/jboss-ejb-client/commit/d620c9df2d050e2e218e18c23991ab97915ecd5d
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.