Jconsole cannot connect to java processes running Windows 7 Services

We have a Java process that we run as a Windows service (using srvany). It works with Java 1.6 (1.6.0.23 at the moment).

In the past (Windows XP), I could connect JConsole to processes, in Windows 7 I can no longer do this.

If I run jconsole <pid> , I get "Invalid process id: 4488". Services run as a SYSTEM user.

If I force the service to start as a user on my desktop (using "Logging in as this account"), the service process ID is displayed in JConsole, but they are inactive and I cannot connect.

Is it impossible to dynamically connect to Java processes when they run as a Windows 7 service?

+6
java windows-7 service jmx
source share
6 answers

Perhaps this is a 64-bit / 32-bit problem, I have several applications compiled with a 32-bit JDK that could not be opened using the JConsole from the 64-bit JDK on Windows 7 64bit after loading the 32-bit JDK.

+3
source share

Others were able to run jstack in 2008r2 , which may give some insight into how to connect jconsole to Windows 7. As you noted in your comment, permissions are important. If the service and jconsole cannot access the temp directory to write to the appropriate hsperf subdirectory, this will not work. The location of the temporary directory, the user that is running the service, and the user running jconsole are also important.

Starting SysInternals psexec -s -i <jdk_home>\bin\jconsole <PID> can be used to start jconsole as a Local System, the same user that I assume is used to start your service.

My jconsole experience with JDK 1.5 in Server 2008 as a system user was unsuccessful. With permissions that I thought should have been enough, I got the error "Could not open PerfMemory." Java 1.6 may be a different story.

In light of all the problems with running jconsole locally, you would probably be lucky to configure it to accept remote connections . You can configure it for local access when your firewall blocks this port from external access.

+1
source share

I am currently facing the same problem, but on Windows 2003 R2 (SP2). An error was detected in the Oracle Bug database (error 6499729) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399729

In addition, there is a detour at the end. It talks about installing java in "install" mode :-), but it does not work for me on Windows 2003. But your mileage may change.

0
source share

Add the following JAVA_OPTION:

 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8086 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false 

Then, use JConsole to connect the remote session: local: 8086

0
source share

Change the variable variable TEMP and Tmp to another folder you created. Like c: \ theTemp

0
source share

Perhaps this is a problem with the %TMP%/hsperfdata_{USER_NAME} folder. In my case, it worked after I:

  • close all applications running on the JVM
  • delete the %TMP%/hsperfdata_{USER_NAME} folder (for example: C: /Temp/hsperfdata_MyUser )
  • reopen JConsole (it recreates the folder)

Hope it helps. You can also view this thread in the Oracle community .

0
source share

All Articles