soam's home

home mail us syndication

Archive for February, 2010

jconsole, ec2, ubuntu

Remote debugging your jmx enabled process in the ec2 cloud via jconsole isn’t easy for any number of reasons. Perhaps it’s the NAT setup at AWS. Perhaps it’s Ubuntu or Linux related. The most common workarounds given are to have jconsole run on the remote box and either export its display locally via X (using, for example ssh -X or ssh -Y to tunnel) or via VNC. I found the former too slow and the latter too time consuming to set up on our existing systems.

However, I discovered nx, a set of technologies to greatly compress the X protocol, was very easy to set up on our Ubuntu boxes. It made the process of running jconsole remotely but displaying to my laptop locally very tolerable indeed. Not surprising as nx is intended to allow you to run xterm even over dialup! Here are the set of steps I followed (instructions derived from the nomachine site) to set up a nx enabled account on a remote Ubuntu Hardy Heron box. Your mileage may well vary.

On your remote box:

  1. install jconsole if you don’t have it. It’s in the Sun JDK package: apt-get installĀ  sun-java6-jdk
  2. Get the nx debian packages from nomachine:
    1. wget (64 bit:
    2. wget (64 bit:
    3. wget (64 bit:
  3. Required by nxserver: apt-get install libaudiofile0
  4. Install nx client, node, server:
    1. dpkg -i nxclient_3.4.0-5_i386.deb
    2. dpkg -i nxnode_3.4.0-6_i386.deb
    3. dpkg -i nxserver_3.4.0-8_i386.deb
  5. Create an nx enabled account called “nxtest”. You supply the account password.
    1. /usr/NX/bin/nxserver –useradd nxtest –system
    2. You might have to edit ~nxtest/.profile to add the “/usr/bin” to the PATH if it’s not added already.
    3. There are other and more secure ways of doing this.
  6. Install enough X libraries to get the remote desktop going. You can do various patchwork stuff but nx appearts to work best with KDE, so: sudo apt-get install kubuntu-desktop

On your local box:

  1. go to, download and install the free nx client for your PC type.
  2. start up the nx client
  3. give the remote hostname/ip address, provide a session name
  4. username: nxtest, password: <whatever password you used to set up the account>
  5. this should open a remote desktop with KDE running
  6. run “jconsole” as a separate command, use the remote option to connect to the java process.

That should do it!