Why is there no local MBeanServer if Tomcat is running as a Windows service?

If Tomcat runs as a Windows service (created using the Tomcat Windows Installer), you cannot just enable JMX with -Dcom.sun.management.jmxremote. You also need to install -Dcom.sun.management.jmxremote.port=<port>. This is specifically explained here: Cannot use JConsole with Tomcat running as a Windows service

However, I have not found an explanation WHY this is how it is.

+3
source share
1 answer

I was a little lost and confused when I wrote a question. Here is what I learned at the same time. Typically, the Tomcat Windows service runs under the local system account. This is the main reason for all the fuss.

-Dcom.sun.management.jmxremote JVM JMX . JMX-, JVM (, ), MBeanServer : MBeanServerFactory.findMBeanServer(<specific-agent-ID-or-null>). JConsole Tomcat. : https://blogs.oracle.com/nbprofiler/entry/monitoring_java_processes_running_as.

, , -Dcom.sun.management.jmxremote.port=<port>. JMX JConsole localhost:<port>. Java :

JMXServiceURL target = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:<port>/jmxrmi");
JMXConnector connector = JMXConnectorFactory.connect(target);
connector.getMBeanServerConnection();
+1

All Articles