tags:

views:

1171

answers:

4

I'm trying to open a JMX connection to java application running on a remote machine.

The application JVM is configured with the following options:

  • com.sun.management.jmxremote
  • com.sun.management.jmxremote.port=1088
  • com.sun.management.jmxremote.authenticate=false
  • com.sun.management.jmxremote.ssl=false

I'm able to connect using localhost:1088 using jconsole or jvisualvm. But I'm not able to connect using xxx.xxx.xxx.xxx:1088 from a remote machine.

There is no firewall between the servers, or on the OS. But to eliminate this possibility I telnet xxx.xxx.xxx.xxx 1088 and I think it connects, as the console screen turns blank.

Both servers are Windows Server 2008 x64. Tried with 64-bit JVM and 32-bit, neither work.

A: 

Try using ports higher than 3000.

darko.topolsek
Tried 31088, same issue
tuler
+2  A: 

I'm not that much into Windows Server edition, but had it been on Linux that problem would be that localhost is the loopback interface, you need to application to bind to your network interface. You can try and use 'netstat' to confirm that its not bound to the expected interface. You should to make this work by invoking the program with the system parameter java.rmi.server.hostname="YOUR_IP", either as an env. var. or using

java -Djava.rmi.server.hostname=YOUR_IP YOUR_APP
takete.dk
Works! Thanks a lot!
tuler
A: 

I am facing the same issue. But this solution is not working. Can you please point out what wrong i did.

I tried giving the below config in catalina.sh in remote tomcat where 192.168.1.1 is my ip (not sure that is right one)

JAVA_OPTS="-Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=9078 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false"\ -Djava.rmi.server.hostname=192.168.1.1

Niger
The IP must be the tomcat IP, not yours
tuler
A: 

Niger, it seams that your ending quote comes too early. It should be after the last parameter.

This trick worked for me.

I noticed something interesting: when I start my application using the following command line:

java -Dcom.sun.management.jmxremote.port=9999
     -Dcom.sun.management.jmxremote.authenticate=false
     -Dcom.sun.management.jmxremote.ssl=false

If I try to connect to this port from a remote machine using jconsole, the TCP connection succeeds, some data is exchanged between remote jconsole and local jmx agent where my MBean is deployed, and then, jconsole displays a connect error message. I performed a wireshark capture, and it shows data exchange coming from both agent and jconsole.

Thus, this is not a network issue, if I perform a netstat -an with or without java.rmi.server.hostname system property, I have the following bindings:

 TCP    0.0.0.0:9999           0.0.0.0:0              LISTENING
 TCP    [::]:9999              [::]:0                 LISTENING

It means that in both cases the socket created on port 9999 accepts connections from any host on any address.

I think the content of this system property is used somewhere at connection and compared with the actual IP address used by agent to communicate with jconsole. And if those address do not match, connection fails.

I did not have this problem while connecting from the same host using jconsole, only from real physical remote hosts. So, I suppose that this check is done only when connection is coming from the "outside".

yohann.martineau