1 Reply Latest reply: Sep 13, 2010 9:25 AM by 843798 RSS

    Connect to JMX remotly over JConsole

    843798
      Hello,

      i m trying to monitor a remote apache server via jmx(jconsole).
      I inserted the following lines in my catalina.sh file:
      CATALINA_OPTS="-Dcom.sun.managment.jmxremote -Dcom.sun.managment.jmxremote.port=8999 -Dcom.sun.managment.jmxremote.ssl=false -Dcom.sun.managment.jmxremote.authenticate=false -Djava.rmi.server.hostname=server-ip or host(i tried both)";
      export CATALINA_OPTS;
      This works fine, if it try it at home in a local network: server is running on my laptop(Ubuntu Linux) and i connect to it via JConsole from my Desktop-PC(windows 7).
      But when i try to connect to this remote server(also Ubuntu Linux) the connection is refused. I ve read, that it might be somehow connected with the iptables of the server. So i just opened the 8999 port for everyone
      Chain INPUT (policy ACCEPT)
      target     prot opt source               destination         
      ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:8999 
      
      Chain FORWARD (policy ACCEPT)
      target     prot opt source               destination         
      
      Chain OUTPUT (policy ACCEPT)
      target     prot opt source               destination         
      ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:8999 
      If i type in "hostname -i", then the ipadress of the server appears, which is correct, as far as I understood from the JConsole FAQ:
      http://download.oracle.com/javase/1.5.0/docs/guide/management/faq.html#config1

      So now i really have no idea why it doesnt work to connect to this server via Jconsole over the internet, since it works perfectly fine in my local network.

      cheers

      Sergey
        • 1. Re: Connect to JMX remotly over JConsole
          843798
          Hi,

          The trick here is that the JMX RMI Connector Server opens two ports: one is for the RMI registry, and that is the port number you can specify via System properties. The other port number is the port used to connect through the stubs returned by the registry.

          There are some ways to get around this - and I suggest you read the section on RMI and Firewall here:
          [http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole|http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole]

          Some other related articles can also be found here:
          [http://blogs.sun.com/jmxetc/tags/firewall|http://blogs.sun.com/jmxetc/tags/firewall]

          Hope this helps,

          -- daniel
          [http://blogs.sun.com/jmxetc|http://blogs.sun.com/jmxetc]