jboss无法加载logmanager

时间:2017-11-03 10:25:40

标签: java jboss jmx

我正在尝试在JBoss AS 7.1.1 Final“Brontes”上启用JMX。 Sofar我在jboss / bin中编辑了startup.conf来保存以下几行:

# Enable JMX Remote
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9999"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

然后在启动jboss时出现以下错误消息:

> WARNING: Failed to load the specified log manager class
> org.jboss.logmanager.LogManager Exception in thread "main"
> java.lang.NoClassDefFoundError: org/jboss/logmanager/Level
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:278)
>         at org.jboss.modules.Module.run(Module.java:247)
>         at org.jboss.modules.Main.main(Main.java:291) Caused by: java.lang.ClassNotFoundException: org.jboss.logmanager.Level
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
>         at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:395)
>         at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
>         ... 4 more

然后我将以下行添加到standalone.conf

JBOSS_MODULES_SYSTEM_PKGS="org.jboss.logmanager"

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
    JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar"

但我仍然收到错误

Could not load Logmanager "org.jboss.logmanager.LogManager"
java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager
        at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.util.logging.LogManager$1.run(LogManager.java:191)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.util.logging.LogManager.<clinit>(LogManager.java:181)
        at java.util.logging.Logger.demandLogger(Logger.java:339)
        at java.util.logging.Logger.getLogger(Logger.java:393)
        at com.sun.jmx.remote.util.ClassLogger.<init>(ClassLogger.java:55)
        at sun.management.jmxremote.ConnectorBootstrap.<clinit>(ConnectorBootstrap.java:846)
        at sun.management.Agent.startAgent(Agent.java:260)
        at sun.management.Agent.startAgent(Agent.java:450)
WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.jboss.as.server.Main.main(Main.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.modules.Module.run(Module.java:260)
        at org.jboss.modules.Main.main(Main.java:291)
Caused by: java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
        at org.jboss.logmanager.Logger.getLogger(Logger.java:60)
        at org.jboss.logmanager.log4j.BridgeRepositorySelector.<clinit>(BridgeRepositorySelector.java:42)
        ... 7 more

现在我想出了下一步该做什么。我还没有在谷歌上找到任何东西。有人能帮帮我吗?

2 个答案:

答案 0 :(得分:1)

我按照here

步骤解决了这个问题

答案 1 :(得分:0)

对于Wildly 14,您必须将Wildfly Commons和Logmanager添加到类路径,因此JAVA_OPTS如下所示

-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager 
-Djava.util.logging.manager=org.jboss.logmanager.LogManager 
-Xbootclasspath/p:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.4.Final.jar 
-Xbootclasspath/p:/opt/jboss/wildfly/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.4.0.Final.jar 
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=127.0.0.1 
-Dcom.sun.management.jmxremote.port=10001 
-Dcom.sun.management.jmxremote.local.only=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false -Xms2g -Xmx2g -Xss512k 
-XX:SurvivorRatio=2 -Dsun.net.inetaddr.ttl=300 -Djava.net.preferIPv4Stack=true 
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n