Ah, what a fun weekend.. I’m working on a few projects using Seam right now, and I wanted a way to deploy them out onto an actual server so that other people could look at them. Normally, you’d have a dedicated server for running Java apps, but those are kinda pricey, especially for while you are just prototyping - and if you are like me and have about 90% of your projects that never leave prototyping :)

So, I decided to stick it on a VPS for now, since a VPS can be had for $50 or less per month. The one I am using is from Rackforce - they have decent prices and, more importantly, their VPS is the only one I’ve been able to allocate enough memory on to run a Java server of any sort.

So, anyway, we run into a few problems when trying to do this:

1) Seam requires an EJB3 container, and you can only get EJB3 with JBoss AS if you use the gui installer.

2) Memory

So, first we are faced with how to actually install JBoss on our VPS, since we can’t run the gui installer. The answer is actually really simple - just run the gui on your desktop, zip up the result, and upload it to your server. When I did this, I didn’t have to make a single change to the configuration. Yes, it really is that simple :)

Now, when you go to actually run it, you’ll probably get an error right when it tries to start up, due to not being able to allocate enough memory. By default, JBoss AS tries to allocate 512MB - more than most VPS systems have access to. You’ll need to change this to something smaller, but not so small that the app server can’t run. I found 256MB to be the sweet spot on my box. To change it, open up /bin/run.conf and change the -Xmx512M to whatever you decide on. It may take a bit of experimentation to get it to work.

You’ll also probably want to set it up as a service, following these instructions.

Have fun :)