Can't connect to localhost using service: jmx / rmi // ..... When using Visual VM with Tomcat within Vagrant

I have a roaming VM running tomcat and I wanted to connect VisualVM to monitor VM performance during some tests.

I followed this guide to set up this config, which recommended creating a setenv.sh script and placing it inside / usr / share / tomcat7 / bin. I found that setenv won't start, so I put the following in /etc/tomcat/tomcat.conf:

JAVA_OPTS="-Dcom.sun.management.jmxremote=true - Dcom.sun.management.jmxremote.port=9901 -Dcom.sun.management.jmxremote.ssl=false

      

m.sun.management.jmxremote.authenticate = false -Djava.rmi.server.hostname = localhost -Dcom.sun.management.jmxremote.rmi.port = 9909 "

I believe the config works like when running the following, I see the ports are active:

[vagrant@localhost ~]$ netstat -lntu | grep 99
tcp6       0      0 :::9901                 :::*                    LISTEN
tcp6       0      0 :::9909                 :::*                    LISTEN

      

Here is my config from a vagrant file:

  # Ports enabled for VisualVM to work. 
  config.vm.network "forwarded_port", guest: 9901, host: 9905
  config.vm.network "forwarded_port", guest: 9909, host: 9907

      

However, after entering the following config or closing options (tried 127.0.0.1 and enabled "don't require SSL", all I get is "".

I have also tried ports 9901, 9905, 9909.

VisualVM Config

Any thoughts on how to solve this?

+3


source to share





All Articles