'NoClassDefFoundError: /org/wildfly/common/net/HostName' on containerized Wildfly after adding vFunction Agent
Overview
This issue occurs in the following circumstances
- A vFunction Organization installs the Monolithic Java Runtime Agent on their Containerized Application running on a Wildfly Application Server
- After adding the Java Agent hooks into the Application an error is unexpectedly thrown
Picked up JAVA_TOOL_OPTIONS: -agentpath:/shared/vfunction/opt/vfunction/agent/libJVMTIAgent-musl.so=conf=/shared/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:/shared/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=/shared/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override-nerf.properties --add-opens=java.base/java.util=ALL-UNNAMED -Dcom.vfunction.logging.logFile=/shared/vfunction/var/log/vfunction/instances/default-java/vfagent.log -Dsun.util.logging.disableCallerCheck=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:/opt/jboss/wildfly/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.7.0.Final.jar -Xbootclasspath/a:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar
...
WARNING: Failed to instantiate LoggerFinder provider; Using default.
java.lang.NoClassDefFoundError: org/wildfly/common/net/HostName
at org.jboss.logmanager.ExtLogRecord.<init>(ExtLogRecord.java:87)
at org.jboss.logmanager.Logger.log(Logger.java:798)
at org.jboss.logging@3.6.1.Final//org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:56)
at org.jboss.logging@3.6.1.Final//org.jboss.logging.Logger.logf(Logger.java:2400)
at org.jboss.msc@1.5.6.Final//org.jboss.msc.service.ServiceLogger_$logger.greeting(ServiceLogger_$logger.java:41)
at org.jboss.msc@1.5.6.Final//org.jboss.msc.service.ServiceContainerImpl.<clinit>(ServiceContainerImpl.java:88)
at org.jboss.msc@1.5.6.Final//org.jboss.msc.service.ServiceContainer$Factory.create(ServiceContainer.java:253)
at org.jboss.as.server@30.0.0.Final//org.jboss.as.server.BootstrapImpl$ShutdownHook.register(BootstrapImpl.java:227)
at org.jboss.as.server@30.0.0.Final//org.jboss.as.server.BootstrapImpl.<init>(BootstrapImpl.java:55)
at org.jboss.as.server@30.0.0.Final//org.jboss.as.server.Bootstrap$Factory.newInstance(Bootstrap.java:272)
at org.jboss.as.server@30.0.0.Final//org.jboss.as.server.Main.main(Main.java:90)
at org.jboss.modules.Module.run(Module.java:345)
at org.jboss.modules.Module.run(Module.java:313)
at org.jboss.modules.Main.main(Main.java:612)
Steps to Resolve
This issue is due to the use of JAVA_TOOL_OPTIONS to add the Java Agent hooks in the Application. The Xbootclasspath flags must be added to the JAVA_OPTS rather than to the JAVA_TOOL_OPTIONS in order to be picked up before the Wildfly Application Server starts.
Move all vFunction Java Agent startup parameters to the JAVA_OPTS and remove them from the JAVA_TOOL_OPTIONS.