PermGen space error - Glassfish Server

devan picture devan · Oct 7, 2011 · Viewed 48.4k times · Source

I am running java web application using Hibernate and glassfish Server. I am getting

java.lang.OutOfMemoryError: PermGen space exception when after I deploying it several times.

I tried -XX:MaxPermSize=128M in my Environment variables, but it doesn't work.

Answer

vkantiya picture vkantiya · Nov 9, 2011

To solve this problem ( in linux based os ) do following

1) increase memory (so that this problem don't come frequently ) by configuring "domain.xml" in

/glassfish/domain/domain1/config

search for

<jvm-options>-XX:MaxPermSize=

set it to higher value eg- 198m or 256m

2) kill the glassfish process to free the port on which it was running ( in my case it was 8686) open terminal (in linux based os) and type -

sudo netstat -npl | grep 8686

this will result in something like..

tcp6 0 0 :::8686 :::* LISTEN 3452/java

next use

kill -9 3452 to kill that process ( 3452 in this case )

Now try to start glassfish, it should start.