Tomcat: OutOfMemoryError Permgen Space

2019-04-17 02:25发布

I am developing a JSP application using Tomcat 6.

Since I did add Quartz Scheduler Framework and Log4J library to project, Tomcat start throwing this exception when redeploying.

I have readed about the problem causes, and now I know that have to be with the class loader.

So, I guess the problem can be caused by the logger library that load some classes automatically.

How can I deal with this problem? There is alternative way to setup the logger without using the log4j.properties file to ensure that classloader will work correctly.

1条回答
地球回转人心会变
2楼-- · 2019-04-17 03:22

One way is to increase your permgen space by adding the following JVM arguments to below

-XX:MaxPermSize=256m

But it will only delay the OOM error. If you do redeployment again and again, you will run into the permgen out of memory again. The reason is explained very clearly in this article, which I won't repeat here. http://frankkieviet.blogspot.com/2006/10/classloader-leaks-dreaded-permgen-space.html. Sorry I do not have a different way to setup the logger differently to avoid this issue. In practice, I always increase the MaxPermSize and then cycle server before deployment.

查看更多
登录 后发表回答