I need to monitor Heap allocation and usage of a Spring Boot remote application using VisualVM. I cannot change the code, but I've seen it done locally, so the configurations in source code must be correct. I need to be able to expose JMX ports. Currently, I have this in the application's configuration
RUN_ARGS="--spring.profiles.active=dev -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=<PORT>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.rmi.port=<PORT>
-Djava.server.hostname=<IP>"
where both instances of <PORT>
are the same, and indentation is added for reading purposes only, nonexistent in the file itself.
In VisualVM, then, I try creating a Remote and adding a JMX Connection to it. I tried both syntaxes, <hostname>:<port>
and service:jmx:<protocol>:<sap>
, but none seem to work.
EDIT: I'm doing this inside the RUN_ARGS variable used in Spring Boot's configuration file. I don't know if it needs to be in another variable, such as JAVA_OPTS
EDIT 2: Checking netstat, I found that the port is there as LISTEN... Now I can't connect from my machine. I'm using this https://theholyjava.wordpress.com/2012/09/21/visualvm-monitoring-remote-jvm-over-ssh-jmx-or-not/
EDIT 3: I found I can telnet to the port, but VisualVM still refuses it...