Thursday, October 17, 2013

Tomcat – Java.Lang.OutOfMemoryError

Apache Tomcat server may spit this error. To solve this error you need to update file.

1. Locate in bin directory. (Eg : apache-tomcat-7.0.22/bin/
2. Edit it and append this line,

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

3. Save file and restart the server.

Thats it.

Partial example of the file
#   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: 609438 2008-01-06 22:14:28Z markt $
# ----------------------------------------------------------------------------
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m 
-Xmx1536m -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.
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
# resolve links - $0 may be a softlink

No comments:

Post a Comment

Total Pageviews