Blog

How to fix the Jboss7 Error : java.lang.out of memory error permgen space

Linux

How to fix the Jboss7 Error : java.lang.out of memory error permgen space

If you get an error ‘java.lang.Out Of Memory Error: PermGen space’ in your Jboss application, may be memory space not enough for running your application,

The below error shows on the browser,

HTTP Status 500 -
java.lang.OutOfMemoryError: PermGen space

Also, you can verify some information from the Jboss log file using the tail command,

$ tail -f /usr/local/jboss/server/default/log/server.log

the logs are below,

Caused by: java.lang.OutOfMemoryError: PermGen space
2024-02-02 18:54:09,154 WARN  [org.jboss.seam.web.ExceptionFilter] exception root cause
2024-02-02 18:54:09,154 WARN  [org.jboss.seam.web.ExceptionFilter] running exception handlers

Before increasing MaxPermSize parameter  for the Jboss application need to check that existing allocated space using ps aux command

ps aux | grep java

The ps command outputs below,

root     15274 20.5 20.7 1714596 424100 ?      Sl   17:26  26:51 /usr/java/jdk//bin/java -Dprogram.name=run.sh -server -Xms128m -Xmx800m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/usr/local/jboss/lib/endorsed -classpath /usr/local/jboss/bin/run.jar:/usr/java/jdk/lib/tools.jar org.jboss.Main

Add MaxPerSize :

Open your jboss bin directory  /jboss-path/bin

cd /usr/local/jboss/bin

Before the update your memory space limit takes a backup copy at any file name, and update the changes,

if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
fi

Once make the changes need to restart Jboss

$  kill -9 <PID>

$ /usr/local/jboss/bin/run.sh
Spread the love

Leave your thought here

Your email address will not be published. Required fields are marked *