Search code examples
javatomcatrmijmx

Tomcat JMX/RMI: How server interface is chosen?


I enable JMX server and JMX Registry in Tomcat using

<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
      rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />

Client connects to 10001 and Tomcat returns its address and port 10002, right? But if I have several addresses on the interface Tomcat returns the first one.

  • Is this a tomcat or RMI issue?
  • How can I set interface and/or IP address to be returned to the client?
  • Is it possible to use JMX directly over the one TCP port with out of all that RMI stuff?

Solution

  • For you question: you should specify -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx as outlined in the answer Tomcat 6, JMX and the dynamic port problem

    As an answer how to configure direct access: specify the JMX remote port as outlined in Monitoring and Managing Tomcat:

        set CATALINA_OPTS=-Dcom.sun.management.jmxremote
        -Dcom.sun.management.jmxremote.port=%my.jmx.port%
        -Dcom.sun.management.jmxremote.ssl=false 
        -Dcom.sun.management.jmxremote.authenticate=false
    

    As far as understand, the calls are still done as RMI calls.