Does Java 6 open a default port for JMX remote connections?

前端 未结 7 1090
终归单人心
终归单人心 2020-12-07 09:46

My specific question has to do with JMX as used in JDK 1.6: if I am running a Java process using JRE 1.6 with

com.sun.management.jmxremote

7条回答
  •  盖世英雄少女心
    2020-12-07 10:32

    The documentation seems to indicate that the JMX agent uses a local ephemeral port, unless you specify the following property:

    com.sun.management.jmxremote.port=portNum
    

    Default ports are avoided because you could have many java applications on one system, and if there was a default port, only one application would be able to be managed! The above configuration property is provided for the express purpose of remote management.

    If you must insist on using an ephemeral port, then the URL of the JMX agent should be accessible from within the JVM, through the following system property (although this is likely to be a local address):

    com.sun.management.jmxremote.localConnectorAddress
    

    Note: I guess you could always open a socket on a remotely-available address and proxy requests on to the local socket, but using the available option seems far more attractive!

提交回复
热议问题