I’ve been playing around with JRuby on Rails and Glassfish and really like the simplicity of deploying simple WAR files to a Glassfish server. Messing around with Apache configurations and managing a bunch of mongrel processes is just not my favorite pastime, plus I like to have the option of running other J2EE webapps on the same server, and interface my RoR app with existing Java libraries.
I ran into some problems trying to get the updatetool for Glassfish working on my VPS (at Rimuhosting) though. The updatetool is a Java Swing app and I’ve never run any GUI apps on this remote host before. It doesn’t have Gnome or KDE running so VNC was not an option. The trick is mostly just to set up your systems for running remote X11 applications over a SSH tunnel. Here’s how I got it to work…. I should say this server runs Ubuntu Hardy and locally I’m on Mac OS X so the X11 install from the Mac OS installation disks was the easy part.
Here’s what I had to do on the remote host:
open /etc/ssh/sshd_config and make sure you set
in /etc/ssh/ssh_config check that you have the following settings:
ForwardAgent yes ForwardX11 yes
there are a few other dependencies that you may not have yet on a clean Ubuntu install. I was getting very confusing java link errors in my stacktraces until I’d installed all of them. So grab these with:
sudo apt-get install xauth libxp-java libxtst-dev libxi-dev
at this point, log out and log back in with
ssh -X yourname@yourhost
The -X option is important here : it’s telling the server that you’re going to want to run a X11 application over this SSH tunnel.
On my system I got the following message after logging back in:
/usr/bin/X11/xauth: creating new authority file /root/.Xauthority
that’s all. I was now able to run the Glassfish updatetool simply by calling
and the application came up nicely on my Mac desktop. These steps will probably work to run just about any Java Swing application on a remote Ubuntu/Debian server.
I hope this helps some people…