Monthly Archives: June 2014

Glassfish setup and managing

Okay, my web-apps are running on Glassfish, and each time I reinstall it I’ve to search my notes to find all the options I usually modify for having it well working.

So I finally decided to put them all on a public post to share with myself and my colleagues, and eventually anyone who may be facing the same problems. Most of the tips and configuration here are related to version 3 of Glassfish. Note that this post may (should) be regularly updated.

 

Summary:

To go straight to the point, here are the principal configuration tricks I’m using, many of them have been found here. See bellow for more details and links about problems/solutions.

  • increase permsize (used by the class loader each time an application is loaded) : -XX:MaxPermSize=512m and -XX:PermSize=512m
  • Use option -server
  • Increase the memory: e.g.  -Xmx4096m and -Xms4096m (Xmx = max memory, Xms = memory allocated at startup)
  • increase the max and min size of http-thread-pool to 32 and 16 (see bellow)

 

Problem: Server stops responding:

I had set up a web service to run a local application on a remote machine and get back the result through a Java API. After some (not so much) time, the application stopped responding… I eventually understood that the Glassfish server was missing

I first found I should add this option:

-Dcom.sun.enterprise.server.ss.ASQuickStartup=false

Yes, I don’t know what it means yet, I’ll have to dig it out before to add it on production server (source: https://www.java.net/node/677689)

What helped me in this case was to increase the max and min size of the thread pool (under server-config, thread pools, http-thread-pool), to 32 and 16 respectively.

 

Problem: Deploy CommandException Error

In some cases it was just impossible to redeploy some of my applications. The error message was There is no installed container capable of handling this application . Unexpectedly, it turned out that the problem was that the application was not correctly canceled from the Glassfish application directory (source: http://stackoverflow.com/questions/5206712/glassfish-deploy-commandexception-error/), so I just had to remove it manually.

Problem:  Loader_<xxx> directories in generated/jsp application folders are not deleted after server

Yep, my Glassfish installation directory was becoming HUGE, particularly the generated directory. This directory was not cleaned automatically in some Glassfish versions. Adding the next lines to the startup script (or removing manually the directory from time to time) solved the problem:

if [ “$1” = “start-domain” ]; then
echo “Removing generated folder…”
rm -rf ../domains/domain1/generated
sleep 2
fi

source: https://java.net/jira/browse/GLASSFISH-19162