I´m trying to install an application health monitoring application that can monitor J2EE web transactions and I need to put a javaagent into my Tomcat somehow but am not clear on exactly how to do this, I am using Linux and have been instructed by the software company that makes this product to do something like below:
-javaagent:<Path to the WebTransactionAgent.jar>
I have received further support from them and they basically said to put this into the appropriate .sh file (but they weren´t able to tell me which file that is for Tomcat)
I tried putting this in the catalina.sh file but it does not seem to be working:
JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=256m -javaagent:"C:\WebTransactionAgent.jar"
Any advice is appreciated
For Unix/Linux, do this in
<tomcat_home>/bin/setenv.sh
, e.g.You might need to create this file if not present and
chmod
it to711
or755
.For Windows, the counterpart is
setenv.bat
.To add to mindas' answer, the
-javaagent
command could also be added to theJAVA_OPTS
environment variable in one of the following (if they exist):<tomcat_home>/conf/tomcat6.conf
or
<tomcat_home>/bin/catalina.sh
Use JAVA_OPTS as CATALINA_OPTS would not allow JVM options
[option2]=[value2]
.Example, for adding jacocoagent.jar with options as below, only JAVA_OPTS will work.