-
톰켓 Permgen 메모리 설정하기기술과 산업/언어 및 프레임워크 2015. 2. 11. 10:15728x90
Thanks Mkyong!!
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.
2. Windows
Tomcat is managed by this script file
catalina.bat, dive inside the script, you will find out thatcatalina.batalways find and run thesetenv.batfile 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.batmanually, and put it into the${tomcat-folder}\binfolder.${tomcat-folder}\bin\setenv.batset 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.batfile to set the environment variable automatically.{$tomcat-folder}\bin\catalina.bat restart
3. Linux
On Linux, the process is same, just Tomcat is using
catalina.shandsetenv.shinstead.3.1 Find out where is
catalina.sh:catalina.sh$ sudo find / -name "catalina.sh" Password: find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /Users/mkyong/Downloads/apache-tomcat-6.0.35/bin/catalina.sh
3.2 Review the
catalina.sh, script, it behaves like Windows, but usesetenv.shinstead.//... # Ensure that any user defined CLASSPATH variables are not used on startup, # but allow them to be specified in setenv.sh, in rare case when it is needed. CLASSPATH= if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then . "$CATALINA_BASE/bin/setenv.sh" elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then . "$CATALINA_HOME/bin/setenv.sh" fi //...
3.3 Create a
setenv.shmanually, and put it into the${tomcat-folder}\bin\folder.${tomcat-folder}\bin\setenv.shexport JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m"
P.S With double quotes, export JAVA_OPTS=”{value}”.
3.4 Restart Tomcat.
http://www.mkyong.com/tomcat/tomcat-javalangoutofmemoryerror-permgen-space/
728x90'기술과 산업 > 언어 및 프레임워크' 카테고리의 다른 글
[Java] Android apk 파일 정보 (1) 2015.04.12 자바(JAVA)에서 아이피(IP) 주소 얻기 (1) 2015.03.20 [HTML] 화면 중앙 위치 시키기 (1) 2015.02.04 springframework + commons-configuration + jasypt 사용 예 (1) 2015.01.31 security 네임스페이스 붙이기 싫을때 (0) 2015.01.27