Sunday, July 1, 2012

Connect to jconsole to a remote server

Recently, I've encountered problem for connecting jconsole to my remote server (it was tomcat server). Locally, it did work but remotely, it didn't,
I used JDK 1.7 (it may be linked ... ) and ubuntu (it may be linked also).

So I've added the following property:
-Djava.rmi.server.hostname=michael-ubu 


and it started working ...

Here's the doc that finally helped me:

http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/javarmiproperties.html


java.rmi.server.hostname
The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. The default value of this property is the IP address of the local host, in "dotted-quad" format.






This one also helped me:

I had a similar, if not the same, problem. I could connect to the JMX server if I started jconsole locally on the machine.
It appears the RMI server was not listening on the correct ip. So, as was suggested in this related question, I added the following:
-Djava.rmi.server.hostname=<host ip>
to JAVA_OPTS as well, and then it worked.