Reputation: 1500
I see that tons of questions posted in SO and other sites to increase tomcat memory when outoferror occurs. But none of them looks the same because some of them said use CATALINA_OPTS
and some said JAVA_OPTS
. and the location mostly they said like bin/setenv.sh
if no file created it.
I follow the above things and still could not set the memory
correctly as expected.
I have created the setenv.sh
file inside bin directory of currently using tomcat.But still heap space is not increased.
CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
this is my content of setenv.sh and please anyone explain what is the problem here, and whether set
or export
need to use in setenv.sh.
Can any one guide me for this?
Upvotes: 1
Views: 798
Reputation: 641
Please try to edit the bin/setenv.sh
export CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
JAVA_OPTS
is passed to all JVM processes running on the same machine.
Use CATALINA_OPTS
if you specifically want to pass JVM arguments to Tomcat.
By using the ps -eaf | grep 'tomcat'
in the terminal, we can confirm the values.
Eg.,
root 32451 1 99 13:57 pts/1 00:00:07 /usr/java/jdk1.7.0_79/bin/java
-Djava.util.logging.config.file=/opt/apache-tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC
-Djava.endorsed.dirs=/opt/apache-tomcat/endorsed -classpath /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar
-Dcatalina.base=/opt/apache-tomcat
-Dcatalina.home=/opt/apache-tomcat
-Djava.io.tmpdir=/opt/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start
Upvotes: 1