简体   繁体   中英

Using same port for Server and remote JMX beans

We are using Embedded Jetty as our webserver running on port 8080 and want to monitor the application on Jconsole. We are using the following system property when starting the Jetty server specific to JMX:

-Dcom.sun.management.jmxremote.access.file=jmxremote.access  
-Dcom.sun.management.jmxremote.password.file=jmxremote.password   
-Dcom.sun.management.jmxremote   
-Dcom.sun.management.jmxremote.authenticate=true   
-Dcom.sun.management.jmxremote.ssl=false   
-Dcom.sun.management.jmxremote.port=8081  

Although, JMX and Webserver are running on two different ports, is there a way for client to access JMX via Jconsole/JvisualVM using port 8080? Is JMX Proxy going to help me in anyway? Is it possible in any way?

Thanks in advance.

Ajay

Not without some effort. In a nutshell, there can always only be a single server on one port (or the other way around: Servers can't share a port).

If JMX was supporting HTTP requests, then you could run it as a servlet on the same HTTP server. There would be one port (used by the HTTP server) and then the HTTP URLs would allow the server to determine whether the client wanted to talk to JMX or the web application.

But JMX doesn't support HTTP requests directly. You can try Jolokia ( see this question ) or you can write servlets which allows a client to query certain mbeans (but without JMX protocol).

JMX规范具有可以使用任何协议进行传输的Connector ,请参见http://en.wikipedia.org/wiki/File:Jmxarchitecture.png

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM