本文介绍了与Wildfly 15一起使用JMX导出器时出现NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在将Wildfly 15与JMX Exporter一起使用.启动WildFly服务器时,出现以下异常,并且我的想法已用尽.该程序包位于modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.4.0.Final.jar
下.
We're using Wildfly 15 with JMX Exporter. When starting the WildFly server I get the following exception and I'm running out of ideas. The package exists under modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.4.0.Final.jar
.
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/jboss/wildfly-15.0.1.Final
JAVA: /opt/java/jdk1.8.0_201/bin/java
JAVA_OPTS: -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:/opt/jboss/wildfly-15.0.1.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.5.Final.jar -Xbootclasspath/p:/opt/jboss/wildfly-15.0.1.Final/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.1.6.Final.jar -Xbootclasspath/p:/opt/jboss/wildfly-15.0.1.Final/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-1.0.3.GA.jar -javaagent:/opt/jboss/wildfly-15.0.1.Final/prometheus/jmx-prometheus.jar=9404:/opt/jboss/wildfly-15.0.1.Final/prometheus/config.yaml -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -server -Xmx3G -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
=========================================================================
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Listening for transport dt_socket at address: 8787
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:796)
at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:53)
at org.jboss.logging.Logger.logf(Logger.java:2398)
at org.jboss.msc.service.ServiceLogger_$logger.greeting(ServiceLogger_$logger.java:40)
at org.jboss.msc.service.ServiceContainerImpl.<clinit>(ServiceContainerImpl.java:91)
at org.jboss.msc.service.ServiceContainer$Factory.create(ServiceContainer.java:250)
at org.jboss.as.server.BootstrapImpl$ShutdownHook.register(BootstrapImpl.java:231)
at org.jboss.as.server.BootstrapImpl$ShutdownHook.access$100(BootstrapImpl.java:221)
at org.jboss.as.server.BootstrapImpl.<init>(BootstrapImpl.java:72)
at org.jboss.as.server.Bootstrap$Factory.newInstance(Bootstrap.java:278)
at org.jboss.as.server.Main.main(Main.java:106)
at org.jboss.modules.Module.run(Module.java:352)
at org.jboss.modules.Module.run(Module.java:320)
at org.jboss.modules.Main.main(Main.java:593)
推荐答案
我终于通过设置以下JAVA_OPTS
设法使其运行:
I finally managed to get it running by setting the following JAVA_OPTS
:
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager
# We need to add this JAR explicitly to avoid a NoClassDefFoundError.
-Xbootclasspath/p:${JBOSS_HOME}/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.4.0.Final.jar
-Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.5.Final.jar
-javaagent:${JBOSS_HOME}/prometheus/jmx-prometheus.jar=9404:${JBOSS_HOME}/prometheus/config.yaml"
请记住要根据您的设置修改版本.
Keep in mind to adapt the versions depending on your setup.
这篇关于与Wildfly 15一起使用JMX导出器时出现NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!