I wish to update the JAVA_OPTS
used by Tomcat 7 to enable JMX monitoring.
When I look at the internet I see 2 primary ways to do it:
Using "setenv.sh" [The popular way]
Update "/etc/default/tomcat7"
Now which is the recommended way to do this? What are the advantages and disadvantages of each?
setenv.sh
is the recommended way.
The advantage is closest path to manipulate. Also whenever you need to deploy multiple apps with different conf you can set each app different setenv.sh
.
For example for me I am serving 3 apps: first folder calling serverA pointing in conf by CATALINA_BASE=/var/tomcat/serverA
.
Here is a sample code catalina.sh
reading all setenv to set memory as their conf.
path:// Enviroment/tomcat/serverA/bin/setenv.sh
#!/bin/sh
JAVA_HOME=/usr/java
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server
-Xms1256m
-Xmx1256m
-XX:NewSize=256m
-XX:MaxNewSize=256m
-XX:PermSize=256m
-XX:MaxPermSize=256m
-XX:+DisableExplicitGC
-XX:+CMSClassUnloadingEnabled"
CATALINA_HOME=/var/tomcat
CATALINA_BASE=/var/tomcat/serverC
export JAVA_HOME JAVA_OPTS CATALINA_HOME CATALINA_BASE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With