Often time, Tomcat may hits the following java.lang.OutOfMemoryError: PermGen space error.

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
It’s usually happened after the Tomcat restarts a few times.

1. Solution
By default, Tomcat is assigned a very little PermGen memory for the running process. To fix it, increase the PermGen memory settings by using the following Java VM options.

-XX:PermSize<size> - Set initial PermGen Size.
-XX:MaxPermSize<size> - Set the maximum PermGen Size.
In the next step, we will show you how to set the VM options in Tomcat, under Windows and Linux environment.

2. Windows
Tomcat is managed by this script file catalina.bat, dive inside the script, you will find out that catalina.bat always find and run the setenv.bat file to set the environment variables.

{$tomcat-folder}\bin\catalina.bat
//...
rem Get standard environment variables
if not exist "%CATALINA_BASE%\bin\setenv.bat" goto checkSetenvHome
call "%CATALINA_BASE%\bin\setenv.bat"
goto setenvDone
:checkSetenvHome
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
:setenvDone
//...
2.1 To set the environment variable on Windows, create a setenv.bat manually, and put it into the ${tomcat-folder}\bin folder.

${tomcat-folder}\bin\setenv.bat
set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m
P.S No double quotes, set JAVA_OPTS={value}.

2.2 Restart Tomcat, it will call the setenv.bat file to set the environment variable automatically.

{$tomcat-folder}\bin\catalina.bat restart

Tomcat java.lang.OutOfMemoryError: PermGen space error的更多相关文章

  1. Tomcat – java.lang.OutOfMemoryError: PermGen space Cause and Solution

    Read more: http://javarevisited.blogspot.com/2012/01/tomcat-javalangoutofmemoryerror-permgen.html#ix ...

  2. myeclipse tomcat java.lang.OutOfMemoryError: PermGen space错误的解决方法

    错误代码: java.lang.OutOfMemoryError: PermGen space 原因分析: myeclipse或tomcat的内容分配的不够用,启动失败 解决方法: 1.找到tomca ...

  3. Eclipse中启动tomcat: java.lang.OutOfMemoryError: PermGen space的解决方法

    tomcat启动的时候出现这种错误一般是项目引用了太多的jar包,或者反射生成了太多的类,或者有太多的常量池,导致非堆内存中永久保存区域不够,就有可能会报java.lang.OutOfMemoryEr ...

  4. Tomcat – Java.Lang.OutOfMemoryError: PermGen Space

    很多时候,在开发阶段Tomcat重复的重启过程中会遇到java.lang.OutOfMemoryError : PermGen space 错误. 1 2 3 4 java.lang.OutOfMem ...

  5. tomcat启动内存溢出三种解决方案:java.lang.OutOfMemoryError:PermGen space解决办法

    问题: 严重: Error waiting for multi-thread deployment of WAR files to completejava.util.concurrent.Execu ...

  6. tomcat启动报错java.lang.OutOfMemoryError:PermGen space解决办法

    tomcat启动错误提示: 严重: Error waiting for multi-thread deployment of WAR files to completejava.util.concur ...

  7. tomcat服务器java.lang.OutOfMemoryError: PermGen space

    一挂就报内存溢出 下面是TOMCAT日志 JAVA程序是没有报错, Nov 24, 2009 4:07:02 PM org.apache.catalina.core.ApplicationDispat ...

  8. Eclipse中启动tomcat报错java.lang.OutOfMemoryError: PermGen space的解决方法

    有的项目引用了太多的jar包,或者反射生成了太多的类,异或有太多的常量池,就有可能会报java.lang.OutOfMemoryError: PermGen space的错误, 我们知道可以通过jvm ...

  9. [转]Tomcat启动java.lang.OutOfMemoryError: PermGen space错误解决

    原文地址:http://outofmemory.cn/java/OutOfMemoryError/outofmemoryerror-permgen-space-in-tomcat-with-eclip ...

随机推荐

  1. Oracle的闪回操作

    Oracle10g中引入了闪回技术,但这并不意味着所有的表都能闪回成功,当没有足够的磁盘空间,Oracle将使用回收站中的磁盘空间,而且位图连接索引和引用完整性约束也不受回收站的保护. recycle ...

  2. Computer Science Theory for the Information Age-5: 学习理论——VC维的定义以及一些例子

    学习理论——VC维的定义以及一些例子 本文主要介绍一些学习理论上的东西.首先,我们得明确,从训练集上学习出来的分类器的最终目标是用于预测未知的样本,那么我们在训练的时候该用多少的样本才能使产生的分类器 ...

  3. Eclipse背景与字体大小和xml文件中字体大小设置

    1.打开window / Preference,弹出Preference面板  2.展开General标签,选中Editors选项,展开.  3.选中 Text Editors,右边出现 TestEd ...

  4. fping命令测试主机存活

    author:headsen  chen date: 2018-10-09 20:11:22 1,测试一个范围内的主机: fping  -a  -g 192.168.1.1 192.168.1.255 ...

  5. 【BZOJ4285】使者 cdq分治+扫描线+树状数组

    [BZOJ4285]使者 Description 公元 8192 年,人类进入星际大航海时代.在不懈的努力之下,人类占领了宇宙中的 n 个行星,并在这些行星之间修建了 n - 1 条星际航道,使得任意 ...

  6. ios获取设备手持方向——电子罗盘

    转:http://book.51cto.com/art/201411/457105.htm 2014-11-15 19:07 张亚飞/崔巍 中国铁道出版社 字号:T | T 综合评级: 想读()  在 ...

  7. List<String>和String相互转换

    List<String>转String String Message=""; for (String msg : message) { Message = Messag ...

  8. 记录web项目部署到阿里云服务器步骤

    (使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以完成打包,如下图: 2.安装Xshel ...

  9. yii2框架dropDownList的下拉菜单用法介绍

    Yii2.0 默认的 dropdownlist 的使用方法.  代码如下 复制代码 <?php echo $form->field($model, 'name[]')->dropDo ...

  10. ibatis 中#和 $ 符号的区别

    1.数据类型匹配 #:会进行预编译,而且进行类型匹配(自动确定数据类型): $:不进行数据类型匹配. 2.实现方式: # 用于变量替换(先生成一个占位符,然后替换) select * from use ...