3

When I start JConsole it identifies my java process(local) but it is not able to connect to it.

Connection Failed: Retry?
The connection to 17424 did not succeed.
Would you like to try again? 

Selecting connect again gives the same error(17424 is the pid of the java process).On the other hand jvisualvm works perfectly. In jvisualvm I see the following details

PID: 17424
Host: localhost
Main class: Conatainer

JVM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04, mixed mode)
Java: version 1.7.0_11, vendor Oracle Corporation
Java Home: /home/aniket/jdk1.7.0_11/jre
JVM Flags: <none> 

Has anyone encountered this situation before? Is it a bug? Is there a work around?

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289

2 Answers2

5

You may be running JVisualVM as a different user than the user running the Java application. Make sure you're running as the same user or as a super user.

Pace
  • 41,875
  • 13
  • 113
  • 156
0

You could find the answer on the manual .

https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

Under previous releases of the Java SE platform, to allow the JMX client access to a local Java VM, you had to set the following system property when you started the Java VM or Java application.

com.sun.management.jmxremote