views:

3614

answers:

2

I am having problems monitoring a remote Tomcat process. I'm trying to use the Java 6 versions of JConsole/JVisualVM.

I have jstatd running on the remote server with the appropriate security policy. The process is started and the TCP connections are available.

When I try to connect through JConsole, I get 'Connection Failed:jmxrmi'.

When I try to connect through VisualVM, I add the host name and my right-click options are 'Add JMX Connection'. It's unclear to me from the docs whether or not that's what I'd expect to see. When I try to connect, I get:

'Cannot connect using service:jmx:rmi:///jndi/rmi://:/jmxrmi'.

So, the docs suggest I only need have jstatd running remotely to monitor in VisualVM, while the UI is asking for jmxrmi .. Are those the same? I've tried setting up tomcat using jmx rmi options and I also timeout, though I know it's not a firewall issue.

If anyone has had success getting a remote Tomcat process attached in this manner, and could describe how, that would help me out a great deal.

+3  A: 

You need to enable the management extensions to the Tomcat VM. Usually that means passing in something like these:

-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Of course, if you do it the above way make sure your Tomcat isn't visible on the Internet or the port is firewalled from remote access or take similar security measures to avoid being port scanned and compromised. Otherwise use the authentication options.

cletus
+1  A: 

I think it was a firewall issue. My server does not have all ports open, so by following instructions here to use the one open port I have, I was able to make it work.

http://blogs.sun.com/jmxetc/entry/connecting_through_firewall_using_jmx