Application logging throws ModuleNotFoundException on JBoss Application Server
Overview of the Issue
This issue occurs in the following circumstances:
- The vFunction Sudo or Sudoless Controller Installation TGZ is installed on a JBoss Application Server
- After adding the vFunction Agent Startup Parameters into the JVM, the Application is rebooted and the following error occurs
15:23:32,043 INFO [org.jboss.as.jpa] (MSC service thread 1-2) WFLYJPA0002: Read persistence.xml for unpPU
15:23:32,442 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.module.service."name-ejb.jar".main: org.jboss.msc.service.StartException in service jboss.module.service."name-ejb.jar".main: WFLYSRV0179: Failed to load module: name-ejb.jar
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:89) [wildfly-server-6.0.11.Final-redhat-00001.jar:6.0.11.Final-redhat-00001]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1738) [jboss-msc-1.4.5.Final-redhat-00001.jar:1.4.5.Final-redhat-00001]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1700) [jboss-msc-1.4.5.Final-redhat-00001.jar:1.4.5.Final-redhat-00001]
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558) [jboss-msc-1.4.5.Final-redhat-00001.jar:1.4.5.Final-redhat-00001]
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [jboss-threads-2.3.2.Final-redhat-1.jar:2.3.2.Final-redhat-1]
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) [jboss-threads-2.3.2.Final-redhat-1.jar:2.3.2.Final-redhat-1]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) [jboss-threads-2.3.2.Final-redhat-1.jar:2.3.2.Final-redhat-1]
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1364) [jboss-threads-2.3.2.Final-redhat-1.jar:2.3.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:750) [rt.jar:1.8.0_412]
Caused by: org.jboss.modules.ModuleNotFoundException: company.app
at org.jboss.modules.Module.addPaths(Module.java:1266) [jboss-modules.jar:1.8.6.Final-redhat-00001]
at org.jboss.modules.Module.link(Module.java:1622) [jboss-modules.jar:1.8.6.Final-redhat-00001]
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1650) [jboss-modules.jar:1.8.6.Final-redhat-00001]
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:296) [jboss-modules.jar:1.8.6.Final-redhat-00001]
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:280) [jboss-modules.jar:1.8.6.Final-redhat-00001]
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:66) [wildfly-server-6.0.11.Final-redhat-00001.jar:6.0.11.Final-redhat-00001]
... 8 more
Steps to Resolve the Issue
This issue can be resolved by taking the following steps:
- SSH or RDP to the VM running the Application where the vFunction Agent is installed
- Find the location of the relevant Module. In the example above, this is “company.app”. The results returned should include the path to a Modules directory
find $JBOSS_HOME -path '*company/app*'
- Modify the JAVA_OPTS Startup Parameters for the application to include the module.path to the Module identified in the previous step. In the standalone.conf, for example, this could be:
VFUN_OPTS="-agentpath:/tmp/vfunction/opt/vfunction/agent/libJVMTIAgent.so=conf=/tmp/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:/tmp/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=/tmp/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=/tmp/vfunction/var/log/vfunction/instances/default-java/vfagent.log"
### Note the -Dmodule.path below
### Note that the -Dmodule.path comes before the VFUN_OPTS
JAVA_OPTS="-Dmodule.path=/usr/local/company/j2ee/tools/jboss/jboss-eap-7.2/modules $VFUN_OPTS -Dsun.util.logging.disableCallerCheck=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:/usr/local/company/j2ee/tools/jboss/jboss-eap-7.2/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.4.0.Final-redhat-1.jar -Xbootclasspath/a:/usr/local/company/j2ee/tools/jboss/jboss-eap-7.2/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.5.Final-redhat-00001.jar -Xbootclasspath/a:/usr/local/company/j2ee/tools/jboss/jboss-eap-7.2/jboss-modules.jar $JAVA_OPTS"
- Restart the JVM