简体   繁体   English

Tomcat:OutOfMemoryError Permgen空间

[英]Tomcat: OutOfMemoryError Permgen Space

I am developing a JSP application using Tomcat 6. 我正在使用Tomcat 6开发JSP应用程序。

Since I did add Quartz Scheduler Framework and Log4J library to project, Tomcat start throwing this exception when redeploying. 由于我确实向项目添加了Quartz Scheduler Framework和Log4J库,因此Tomcat在重新部署时开始引发此异常。

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. 有另一种方法可以设置记录器,而无需使用log4j.properties文件来确保类加载器正常工作。

One way is to increase your permgen space by adding the following JVM arguments to below 一种方法是通过在下面添加以下JVM参数来增加permgen空间

-XX:MaxPermSize=256m

But it will only delay the OOM error. 但这只会延迟OOM错误。 If you do redeployment again and again, you will run into the permgen out of memory again. 如果您一次又一次地进行重新部署,您将再次遇到内存中的permgen。 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 . 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. 实际上,我总是增加MaxPermSize,然后在部署之前循环服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM