UPDATED: Tunneling Debug and JMX for Alfresco

Back in February I wrote a post on Tunneling Debug and JMX with Alfresco.  Here are a few updates to that post:

0/ For JMX: From Alfresco 3.2 sp1 (enterprise release) on you no longer need to add the custom-core-services-context.xml file.  Instead in the alfresco-global.properties file add monitor.rmi.services.port=50508 to set the static port.

1/ How can I get this work on Windows?  I’ve tested with two options: Cygwin or Putty.

Cygwin: this is option is the most straight forward.  Install Cygwin.  On the Select Packages screen do a search for openssh and select it for install.

The same ssh commands will work for creating tunnels under a Cygwin shell that you can use with Linux or Max OS X.

Putty: The only way I’ve been successful with connecting JMX with putty was by using the plink command line executable.  The graphical interface doesn’t allow you set the first hostname that is needed for the second tunnel.  plink gets this done.

Let’s take a look at some real examples…

For debug:

On the server:

Add the following to your alfresco.sh file:

export JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8082"

The address parameter sets the port you want the debugger to listen on.  Adding this line, will require you to restart Alfresco/tomcat for it to become active.

On the client:

Using standard port forwarding with ssh will enable Java debugging using plink

plink <user>@<ip/host/dns address> -L 2000:localhost:8082 -N

The debugger is then set to connect to localhost using port 2000

For JMX:

On the server:

Modify alfresco.sh:  set -Dcom.sun.management.jmxremote equal to true.  Append -Djava.rmi.server.hostname=dummyhost to the JAVA_OPTS.

Add monitor.rmi.services.port=50508 to alfresco-global.properties

On the client:

Add dummyhost to C:\Windows\System32\drivers\etc\hosts

Using plink from the command line, run the following two commands:

plink <user>@<ip/dns of server> -L 2001:localhost:50500 -N

plink <user>@<ip/dns of server> -L dummyhost:50508:localhost:50508 -N

Now you can connect to Alfresco using a jmx console, like jconsole (ships with jre/jdk).

the connection string will look like this:


Unless you’ve changed them, the default username and password are controlRole and change_asap