Kalpa-W
Kalpa-W

Reputation: 358

Fails to connect through JMX+SSL from VisualVM

I have connected a JMX connection from a machine without SSL. But when I give the SSL though the App is getting launched without any error, VisualVM is unable to establish a JMX connection through the specified port. Following is the command I used to establish JMX connection from the App side.

java -Dcom.sun.management.jmxremote.port=4444 -Dcom.sun.management.jmxremote.password.file="C:/Program Files/Java/jre1.8.0_25/lib/management/jmxremote.password" -Djavax.net.ssl.keyStore="C:/Program Files/Java/jdk1.8.0_25/bin/testkeystore" -Djavax.net.ssl.keyStorePassword=123456 -Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.authenticate=true DemoApp

Please advice.

Upvotes: 1

Views: 1995

Answers (1)

David Vít
David Vít

Reputation: 355

Even though this is a quite old question, @Klara's comments helped me to solve the similar issue very fast.

  1. First, I needed to prepare my trust store for jVisualVM:

keytool -exportcert -alias server -keystore /jkslocation/serverKS.jks -storepass storepassword -file /certificatelocation/certificate.cer

  1. Then I added exported certificate to the trust store: keytool -import -alias server -keystore /jkslocation/clientTS.jks -storepass storepassword -file /certificatelocation/certificate.cer -v

  2. Then clientTS.jks is copied to the client machine running jVisualVM.

  3. jVisualVM is started with trust store parameters: ./jvisualvm -J-Djavax.net.ssl.trustStore=clientTS.jks -J-Djavax.net.ssl.trustStorePassword=clientTSPassword

  4. jVisualVM can access server JMX ports.

Upvotes: 2

Related Questions