将-javaagent添加到Tomcat 6服务器,我应该把它放在哪里以及以什么格式?
我正在尝试安装一个可以监控 J2EE Web 事务的应用程序运行状况监控应用程序,我需要以某种方式将 javaagent 放入我的 Tomcat 中,但不清楚具体如何执行此操作,我正在使用 Linux 并已接受该软件的指导使该产品执行如下操作的公司:
-javaagent:<Path to the WebTransactionAgent.jar>
我已经从他们那里得到了进一步的支持,他们基本上说将其放入适当的 .sh 文件中(但他们无法告诉我哪个文件适用于 Tomcat)
我尝试过将其放入 catalina.sh 文件中,但是它似乎不起作用:
JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=256m -javaagent:"C:\WebTransactionAgent.jar"
任何建议表示赞赏
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 Unix/Linux,请在
/bin/setenv.sh
中执行此操作,例如,您可能需要创建此文件(如果不存在)并将其
chmod
为711
或755
。对于 Windows,对应项是
setenv.bat
。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
.要添加到 mindas' 答案,还可以将
-javaagent
命令添加到JAVA_OPTS
环境变量位于以下之一(如果存在):或/bin/catalina.sh
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
使用 JAVA_OPTS,因为 CATALINA_OPTS 不允许 JVM 选项
[option2]=[value2]
。例如,要添加具有以下选项的 jacocoagent.jar,只有 JAVA_OPTS 有效。
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.