Tomcat - java.lang.OutOfMemoryError: PermGen space
Web Programming/JSP / 2010. 12. 28. 16:58
아래와 같은 에러가 뜰 때의 해결법.
예시 :
============================ HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.OutOfMemoryError: PermGen space note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs. Apache Tomcat/5.5.25 ============================ |
catalina.sh 파일을 수정하여 메모리를 늘려준다.
아래와 같이 변경해 준다. :
1) vi /usr/local/jakarta/tomcat/bin/catalina.sh
2) Add following line into the catalina.sh file.
예시:
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC" |
아래는 일반적인 catalina.sh 파일에 추가한 모습.
예시:
=========================================== # JSSE_HOME (Optional) May point at your Java Secure Sockets Extension # (JSSE) installation, whose JAR files will be added to the # system class path used to start Tomcat. # # CATALINA_PID (Optional) Path of the file which should contains the pid # of catalina startup java process, when start (fork) is used # # $Id: catalina.sh 609438 2008-01-06 22:14:28Z markt $ # ----------------------------------------------------------------------------- JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC" # OS specific support. $var _must_ be set to either true or false. cygwin=false os400=false darwin=false ======================================== |
예시:
root@server[~]# /usr/local/jakarta/tomcat/bin/./shutdown.sh root@server[~]# /usr/local/jakarta/tomcat/bin/./startup.sh root@server[~]# /usr/local/jakarta/tomcat/bin/./catalina.sh run root@server[~]# /scripts/restartsrv tomcat |