Pergunta

My Web application is running on tomcat apache-tomcat-6.0.35 and It was working fine witout any issue.But today I show bellow exception in catalina.out log and was unable to login to the system.

Jul 9, 2013 2:40:15 PM org.apache.coyote.http11.Http11Processor process
SEVERE: Error processing request
java.lang.OutOfMemoryError: PermGen space

I was under impression this exception can be ocuured when you deploy or redeploy a application. But I got this when the application is running without any issues. What could be the reason for this. Kindly advice

Foi útil?

Solução

Each webapp in Tomcat has a separate class loader with a separate set of loaded classes. When we start Tomcat it does not load all classes of all its apps at once but rather it loads the apps lazily. When an app becomes active it starts loading its classes and it may happen that JVM runs out permgen space. That is, it may happen even without redeploying apps.

Outras dicas

add these Optionsto JVM command line when Tomcat is started Or add to IDE VM Options

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

OR

-XX:MaxPermGen=128M

It sounds like one of your webapps is consuming a lot of memory. Have you tried raising the PermGen size? In $CATALINA_HOME/bin/catalina.sh you can add

-XX:PermSize=512m -XX:MaxPermSize=512m

to your JAVA_OPTS so that it allocates enough space to run.

You are getting out of permGen space, try to change this parameters on your tomcat start script

/etc/init.d/tomcat6

JAVA_OPTS="-Djava.awt.headless=true -XX:MaxPermSize=512M"

Set the memory amount as you need.

It definitely is an error that often shows up during deployments. I've seen it occur any number of times in both Grails and Java applications. You can increase your permgen space by adjusting the JVM startup param -XX:MaxPermSize, ie:

-XX:MaxPermSize=256m

This thread covers the issue in detail: Thread

I had this error a few days ago. I fixed it by restarting the real machine - there was a problem with a deploy.

Also you can fix it by adding

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

See possible fix

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top