VisualVM with firewall

Helpfull article which explains how to get JVisualVM running on a Linux system with a firewall: http://blog.markshead.com/1129/connecting-visual-vm-to-tomcat-7/

The trick was to setup a Listener in Tomcat’s server.xml :

  
  <!-- JMX  -->
  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
    rmiRegistryPortPlatform="8000" rmiServerPortPlatform="8001" />

The rmiRegistryPortPlatform will be used by clients to connect, port 8000 in this case.

Then to restrict access :

# JMX
# look at /var/lib/tomcat7/conf/server.xml for port numbers:
# rmiRegistryPortPlatform / rmiServerPortPlatform
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote=true"
JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.access.file=/var/lib/tomcat7/conf/jmxremote.access"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.password.file=/var/lib/tomcat7/conf/jmxremote.password"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true"

The password is stored in /var/lib/tomcat7/conf/jmxremote.password

Advertisements
Posted in Java, Performance, Testing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: