我想监视远程glassfish服务器.我在domain.xml中启用了JMX Connection:
<jmx-connector accept-all="true" address="0.0.0.0" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">
但这没有帮助.我仍然无法使用JConsole连接到服务器.然后我找到了解决方案 – 我需要在domain.xml中指定JVM属性以打开8686端口进行远程连接.
所以我将这些行添加到java-config部分:
<jvm-options>-Dcom.sun.management.jmxremote</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.port=8686</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
但是现在当我启动服务器时,我遇到了以下错误:
Could not load Logmanager
“com.sun.enterprise.server.logging.ServerLogManager”
java.lang.ClassNotFoundException:
com.sun.enterprise.server.logging.ServerLogManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native
Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.util.logging.LogManager$1.run(LogManager.java:166)
at java.security.AccessController.doPrivileged(Native
Method)
at java.util.logging.LogManager.(LogManager.java:156)
at java.util.logging.Logger.getLogger(Logger.java:273)
at sun.management.snmp.util.MibLogger.(MibLogger.java:57)
at sun.management.snmp.util.MibLogger.(MibLogger.java:42)
at sun.management.jmxremote.ConnectorBootstrap.(ConnectorBootstrap.java:760)
at sun.management.Agent.startAgent(Agent.java:127)
at sun.management.Agent.startAgent(Agent.java:239)
javax.management.JMRuntimeException:
Failed to load MBeanServerBuilder
class
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:480)
at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:511)
at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:298)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:213)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:174)
at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302)
at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504)
at sun.management.jmxremote.ConnectorBootstrap.initialize(ConnectorBootstrap.java:392)
at sun.management.Agent.startAgent(Agent.java:127)
at sun.management.Agent.startAgent(Agent.java:239)
Caused by:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native
Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:423)
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:465)
… 9 more Exception thrown by the agent :
javax.management.JMRuntimeException:
Failed to load MBeanServerBuilder
class
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
我该如何解决这个问题?
提前致谢.
解决方法:
解决问题的步骤是:
1.使用默认设置
2.在GlassFish实例的JVM选项中添加-Djava.rmi.server.hostname =.