About the art of building metaphoric solutions to real world problems.
29 Jul
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?)

6 Responses for "How to run glassfish v2ur2 applicationserver on a Strato v-PowerServer C"
Hi. Thanks for the entry. I have a couple of questions (forgive my ignorance of maybe some basic hosting constraints) :
- which linux distro are you using (Debian, Ubuntu)?
- where does apt-get fetch bits from? apt-get shouldn’t invoke the installer.
- is the outofmemory error related to GlassFish v2 or specifically to ur2?
- do you have the exact error message when trying to start the instance with the default MaxPermSize?
- is 512MB really all you get? How is this enforced at the OS level?
GlassFish v3 and its modular/lightweight architecture should be really nice for hosting companies.
thanks!
Hi Alex!
I’m not a hosting pro, too
I configured this virtual server to run Ubuntu Server Edition.
My server came with preconfigured openSUSE 10.3 and Plesk 8.4, but the first thing I did after activating, was switching it to ubuntu.
The out of memory exception was thrown when the apt package manager wanted to start it’s installation routines. I have installed glassfish through apt on several other machines an everything went fine.
And yes… 512mb is all I got
I think strato regulates it through their virtual server settings. But for the moment is sufficient. The site I run there is low on traffic. And should it rise then getting a bigger machine isn’t the problem.
I searched the machine for an error-log of the failed installation attempt, but as far as I have learned there is no log file for apt installations.
Hope this helps,
Lars
I haven’t installed GlassFish on the latest Ubuntu so I’ll try that in a 512Mb-constrained VM. What about when starting GlassFish (the PermGen setting), does domains/domain1/log/server.log contain anything when using the default PermGen setting? Alernatively you can try startting using:
sudo asadmin start-domain domain1 –verbose
to get errors inline.
I did a bit of testing using a VirtualBox 512MB-constrained virtual machine. I don’t seem to run into your memory problem when doing :
% sudo apt-get install glassfishv2
Note you need to have Sun JDK installed (apt-get install sun-java6-jdk) first as neither OpenJDK (for the moment) not gcj will work (the initial domain1 creation will fail).
Hi Alex,
I did some testing too. I have sun-jdk6 installed.
Here’s the output I got once when starting glassfish:
I had to stop the mysqld for launch and then glassfish comes up as usual. But don’t bother. I expected running into trouble like this when installing glassfish on such a lowend configuration. You simply can’t put a liter of beer into a pint.
[...] Plasticboy Blog (link) [...]
Leave a reply