2

I am trying to see threads management of Play application. Need to use JVisualVm to see the threads running. Basically, the JMX port should be enabled to see the Play Application. I am using Play 2.5 with Activator. Using acivator run command to run the application and configuration the Java Args in the build.sbt file like below.

javaOptions ++= Seq(
   "-Dcom.sun.management.jmxremote",
   "-Dcom.sun.management.jmxremote.port=5678",
   "-Dcom.sun.management.jmxremote.local.only=false",
   "-Dcom.sun.management.jmxremote.ssl=false",
   "-Dcom.sun.management.jmxremote.authenticate=false",
   "-Djava.rmi.server.hostname=192.11.1.18"
)

But nothing works with the above configuration. Can anyone help me in this ?

Indra Uprade
  • 773
  • 5
  • 12
Rama Krishna. G
  • 526
  • 2
  • 8
  • 24

1 Answers1

2

The reason why JMX client cannot connect to your server may be a firewall refusing connections to com.sun.management.jmxremote.rmi.port which is randomly assigned by default, so you can set it explicitly to the same value as com.sun.management.jmxremote.port for convenience.

Another reason may be due to wrong value for java.rmi.server.hostname, it must be the same ip address as you're using to access the application using browser.

So, your configuration may look like this:

javaOptions += "-Dcom.sun.management.jmxremote"
javaOptions += "-Dcom.sun.management.jmxremote.port=5678"
javaOptions += "-Dcom.sun.management.jmxremote.rmi.port=5678"
javaOptions += "-Dcom.sun.management.jmxremote.local.only=false "
javaOptions += "-Dcom.sun.management.jmxremote.ssl=false"
javaOptions += "-Dcom.sun.management.jmxremote.authenticate=false"
javaOptions += "-Djava.rmi.server.hostname=192.11.1.18" // make sure it's your app's web address

If nothing helps, refer to VisualVM Troubleshooting Guide.

Also check the resources below for more info on similar issues (they're about docker, but it's essentially the same as connecting to remote host using jmc):

Sergiy Sokolenko
  • 5,967
  • 35
  • 37