簡體   English   中英

在EC2上運行的tomcat 8上使用VisualVM

[英]Using VisualVM on tomcat 8 running on EC2

我試圖在我的系統中使用VisualVM來監視在EC2上運行的Tomcat實例。 我嘗試了在多個博客中提供的有關如何配置它的步驟,但是當我嘗試運行tomcat時,它仍然給出了以下錯誤。

./catalina.sh: 5: /home/gvr/apache-tomcat-8.0.18/bin/setenv.sh: -Dcom.sun.management.jmxremote: not found

我在server.xml添加了以下語句

<listener classname="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiregistryportplatform="10001"
rmiserverportplatform="10002"
uselocalports="true" /> 

我的setenv.sh如下

CATALINA_OPTS="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=ec2-xx-xxx-xx-xx.ap-southeast-1.compute.amazonaws.com"
$CATALINA_OPTS

除此之外,我在tomcat的lib目錄中添加了catalina-jmx-remote.jar

在此輸入圖像描述

誰能請我提供一些提示,可能出錯的地方。 我嘗試了所有與配置VisualVM相關的內容

我在ubuntu上運行Tomcat 8.0.18,java 8

我相信有兩個問題

  • 在setenv.sh中格式化,你需要\\跨行分割
  • 最后一行$ CATALINA_OPTS嘗試執行參數,因此找不到-Dcom.sun.management.jmxremote ...

建議修復

CATALINA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=ec2-xx-xxx-xx-xx.ap-southeast-1.compute.amazonaws.com"
echo $CATALINA_OPTS

我也嘗試過使用JmxRemoteLifecycleListener,它對我不起作用。

這是我如何做到的:1)我選擇1005作為jmx端口,我的setenve.sh就像:

CATALINA_OPTS =“$ CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port = 10005 -Dcom.sun.management.jmxremote.ssl = false -Dcom.sun.management.jmxremote.authenticate = false - Dcom.sun.management.jmxremote.local.only = false -Djava.rmi.server.hostname = localhost“

2)使用ssh重定向jmx端口和rmi

3)使用以下uri運行visualvm:service:jmx:rmi:/// jndi / rmi:// localhost:10005 / jmxrmi

如果您需要更多信息,請查看以下帖子: http//ignaciosuay.com/how-to-connect-a-java-profiler-like-visualvm-or-jconsole-to-a-remote-tomcat-running-上亞馬遜-EC2 /

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM