Advertisement

I bet you just rent your virtual root server from Strato (or any other hoster) and wonder, why you can’t install glassfish via sudo apt-get-install glassfish as you’re used to.

The answer is easy. The installer consumes more than the 256mb of memory Strato reserves for you and the installer ends in an out-of-memory exeption. Yes, we all love that :)

But there is help and it’s easier as you think:

Install glassfish manually

sudo apt-get install ant
cd/opt
sudo wget http://java.net/download/javaee5/v2ur2/promoted/Linux/glassfish-installer-v2ur2-b04-linux.jar
#take whatever glassfish edition you want..
sudo java -Xmx256m -jar glassfish-installer-v2ur2-b04-linux.jar
cd /opt/glassfish
sudo ant -f setup.xml

You have just installed glassfish manually.

Try your installation
Now try this:

cd /opt/glassfish/bin
sudo ./asadmin start-domain domain1

You still have a problem if you get this message:

[...]
Could not create the Java virtual machine.

As default, glassfish’s domains have a fixed memory footprint of 196mb.
We need to cut this down.

Patch the memory settings
All we have to do is to edit the file /opt/glassfish/domains/domain1/config/domain.xml:
Search for this entry:
-XX:MaxPermSize=196m
and change it to
-XX:MaxPermSize=128m

Now restart your application server:

cd /opt/glassfish/bin
sudo ./asadmin start-domain domain1

you should now be able to access the administration frontend at

http://yourserver.com:4848.

The default username and password are admin/adminadmin.
You should change that quick.

Watch out: 512 mb ram isn’t much in the java world – the out-of-memory exception will be your best friend in the future if you don’t code with care (as we all do, don’t we?) :)