Abhi Abhi - 1 year ago 122
Java Question

Using VisualVM on tomcat 8 running on EC2

I am trying to use VisualVM in my system to monitor a Tomcat instance running over EC2. I tried steps provided in multiple blogs about how to configure it, but still when I try to run tomcat it gives me following error.

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

I added following statement in

<listener classname="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
uselocalports="true" />

And my
is as follows


Besides this I have added,
in tomcat's lib directory

enter image description here

Could anyone please provide me some hint, what is possibly going wrong. I tried everything I have found related to configuring VisualVM

I am running Tomcat 8.0.18, java 8 over ubuntu

Answer Source

I believe there are two issues

  • formatting in setenv.sh, you need \ to split across lines
  • last line $CATALINA_OPTS which tries to execute the arguments, hence -Dcom.sun.management.jmxremote not found...

Suggested fix

CATALINA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download