Issue
This Content is from Stack Overflow. Question asked by user1999453
I am new to visualVm and trying to monitor some application which is deployed on Tomcat9 Centos server. I have installed visualVm on my windows laptop and trying to remote connect to the JVM on the centos server but nothing is displayed (Message on visualVm: Not supported for this JVM).
Please find below jdk version installed on centos server:
My tomcat is accessible from my browser as follows:
http://dymmyip:8081/
Based on the online resource I saw that I need to enable JMX on tomcat so I have added the following properties in my setenv.sh(in tomcat/bin folder) file:
export CATALINA_OPTS="
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false"
I have downloaded the lastest vizualVm and created a remote host via File->Add Remote Host. Then Add JMX Connection info as follows:
connection:dymmyip:8081
username :user
Password :dummyPassword
uncheck :do not require ssl
When I try to connect the following screen is displayed:
Can anyone tell me please what I am missing here?
Thanks in advance.
Solution
You can add the missing =true
in your setenv.sh
export CATALINA_OPTS="\
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=8999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false"
You have to chmod
you setenv.sh
too:
$ cd <your-tomcat-dir>/bin
$ chmod a+x setenv.sh
Be sure it is not a firewall issue. Test the connection with telnet dummyip 8999
Be sure using the same JVM on both VisualVM and Tomcat. (Be careful with architecture too: 32 or 64bits)
You can get the last release of VisualVM
here.
To install it:
$ [ -f "/usr/bin/visualvm" ] && sudo mv /usr/bin/visualvm{,.old}
$ wget https://github.com/oracle/visualvm/releases/download/2.1.4/visualvm_214.zip
$ unzip visualvm_214.zip
$ sudo mv visualvm_214 /opt/
$ sudo ln -s /opt/visualvm_214/bin/visualvm /usr/bin/
$ visualvm --jdkhome /usr/lib/jvm/java-17-openjdk-amd64
Use the path you want in --jdkhome
.
This Question was asked in StackOverflow by user1999453 and Answered by Stéphane Millien It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.