处理“java.lang.OutOfMemoryError: PermGen space"错误 [英] Dealing with "java.lang.OutOfMemoryError: PermGen space" error

查看:27
本文介绍了处理“java.lang.OutOfMemoryError: PermGen space"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我在我的网络应用程序中遇到了这个错误:

Recently I ran into this error in my web application:

java.lang.OutOfMemoryError: PermGen space

java.lang.OutOfMemoryError: PermGen space

这是一个典型的 Hibernate/JPA + IceFaces/JSF 应用程序,运行在 Tomcat 6 和 JDK 1.6 上.显然,在多次重新部署应用程序后可能会发生这种情况.

It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6. Apparently this can occur after redeploying an application a few times.

是什么导致了它,可以做些什么来避免它?我该如何解决问题?

What causes it and what can be done to avoid it? How do I fix the problem?

推荐答案

解决方案是在 Tomcat 启动时将这些标志添加到 JVM 命令行:

The solution was to add these flags to JVM command line when Tomcat is started:

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

您可以通过关闭 tomcat 服务,然后进入 Tomcat/bin 目录并运行 tomcat6w.exe 来完成此操作.在Java"下选项卡,将参数添加到Java 选项"盒子.点击确定"然后重启服务.

You can do that by shutting down the tomcat service, then going into the Tomcat/bin directory and running tomcat6w.exe. Under the "Java" tab, add the arguments to the "Java Options" box. Click "OK" and then restart the service.

如果您收到错误指定的服务不作为已安装的服务存在您应该运行:

If you get an error the specified service does not exist as an installed service you should run:

tomcat6w //ES//servicename

其中 servicename 是在 services.msc 中查看的服务器名称

where servicename is the name of the server as viewed in services.msc

来源:orx 对 的评论Eric 的敏捷答案.

这篇关于处理“java.lang.OutOfMemoryError: PermGen space"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆