无法从log4j2客户端GUI连接到我的应用程序

时间:2014-06-09 14:01:41

标签: java jmx log4j2 jconsole connectionexception

操作系统:OSX Mavericks
IDE:Netbeans 8.0(Build 201403101706)
Java:1.7.0_45; Java HotSpot(TM)64位服务器VM 24.45-b08
log4j:2.0rc1

我无法从log4j2客户端GUI连接,无论是将其作为JConsole插件运行,还是作为独立应用程序运行。

以下是我在尝试中使用的细节:

我的申请
- 使用这些VM参数从Netbeans运行:

-Djava.security.policy=~/Downloads/policy -Djavax.management.builder.initial= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
  • 我尝试了各种端口:9010,1099,33445等
  • 我的政策文件的内容(我允许所有内容):

    授予{
    permission java.security.AllPermission;
    };


将客户端GUI作为JConsole插件运行
- 我以前执行的命令:

jconsole -pluginpath ~/Downloads/Software/Development/Java/log4j/2.0/rc1/apache-log4j-2.0-rc1-bin/log4j-core-2.0-rc1.jar:~/Downloads/Software/Development/Java/log4j/2.0/rc1/apache-log4j-2.0-rc1-bin/log4j-jmx-gui-2.0-rc1.jar 

JConsole启动没有问题,但我没有按照手册(http://logging.apache.org/log4j/2.x/manual/jmx.html)看到Log4j2标签

将客户端GUI作为独立应用程序运行
- 我以前执行的命令(我是从JAR所在的目录运行它:

java -cp log4j-core-2.0-rc1.jar:log4j-jmx-gui-2.0-rc1.jar org.apache.logging.log4j.jmx.gui.ClientGUI localhost:9010

- 但是,我得到了一个 java.lang.NoClassDefFoundError

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/logging/log4j/status/StatusLogger
        at org.apache.logging.log4j.core.jmx.Server.<clinit>(Server.java:59)
        at org.apache.logging.log4j.jmx.gui.Client.getStatusLoggerAdmin(Client.java:143)
        at org.apache.logging.log4j.jmx.gui.ClientGUI.addWidgetForLoggerContext(ClientGUI.java:109)
        at org.apache.logging.log4j.jmx.gui.ClientGUI.populateWidgets(ClientGUI.java:98)
        at org.apache.logging.log4j.jmx.gui.ClientGUI.<init>(ClientGUI.java:81)
        at org.apache.logging.log4j.jmx.gui.ClientGUI$2.run(ClientGUI.java:276)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:694)
        at java.awt.EventQueue$3.run(EventQueue.java:692)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.status.StatusLogger
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 20 more

任何建议/指导将不胜感激!提前谢谢。

干杯。

1 个答案:

答案 0 :(得分:0)

我已更新源存储库中的文档,以阐明必须将log4j-api jar添加到jconsole插件路径中。手册页将在下一个版本(rc2)中正确显示。

感谢您报告此事。