Home » Programming

How to run glassfish v2ur2 applicationserver on a Strato v-PowerServer C

29 July 2008 6 Comments

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 Comments »

  • Alexis MP said:

    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!

  • Lars (author) said:

    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

  • Alexis MP said:

    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.

  • Alexis MP said:

    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).

  • Lars (author) said:

    Hi Alex,

    I did some testing too. I have sun-jdk6 installed.
    Here’s the output I got once when starting glassfish:

    sudo /etc/init.d/glassfish start
    Password:
    starting glassfish from /opt/glassfish/bin
    Starting Domain domain1, please wait.
    Log redirected to /opt/glassfish/domains/domain1/logs/server.log.
    Redirecting output to /opt/glassfish/domains/domain1/logs/server.log
    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.
    

    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.

  • Install Glassfish on a virtual server « The JavaDude Weblog said:

    [...] Plasticboy Blog (link) [...]

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.