1

Wanted to analyse perm gen contents. So, tried the utility to print a running JVM's string literal pool (Utility is available here, from How to analyze PermGen contents?)

But I'm getting this error:

Attaching to process ID 8980, please wait... Error attaching to process: Timed out while attempting to connect to debug server (please start SwDbgSrv.exe).

Any idea how to start SwDbgSrv.exe in windows 7?

Community
  • 1
  • 1
user1325695
  • 105
  • 1
  • 2
  • 6

2 Answers2

0

You can attach the debug daemon to your Java program by running jsadebugd . Then you can run the HotSpot Serviceability Agent GUI:

java -cp %JAVA_HOME%\lib\sa-jdi.jar sun.jvm.hotspot.HSDB

and File -> connect to debug server -> localhost. Although this isn't a programmatic dump of all String literals, you will be able to explore more information about your process.

j0k
  • 22,600
  • 28
  • 79
  • 90
jspring
  • 21
  • 6
0

So I also had this issue while I was trying to use dumpclass.jar which was also giving me this error and I think that's because your PrintStringTable and DumpClass both depend on the same underlying jar/tool/system/framework/whatever called sa-jdi.jar

What it does, I have no idea, one feature it has is taking chunks of my life to figure out how to install...

Anyway from what I can tell after reading all 2(!) StackOverflow questions about it is that the version distributed with the java 1.6 SDK (not JRE, it doesn't come with the JRE - oh you didn't already know that, why?) relies on this thing called SwDbgSrv.exe which, I don't know what that is but all you need to know is that the version distributed with the java 1.7 sdk (again SDK not JRE) doesn't use SwDbgSrv.exe.

So ultimately what does this all mean? Well it means that if you acquire sa-jdi.jar by googling for it then you'll land up at this site: http://www.java2s.com/Code/Jar/s/Downloadsajdijar.htm which has the 1.6 version of the jar which requires SwDbgSrv.exe

This means that if you are using a tool that relies on sa-jdi.jar then you definitely want to get the one that doesn't use SwDbgSrv.exe which all that really means is using the java 1.7 sdk, instead of the Java 1.6 JRE/SDK, because the version of sa-jdi.jar that comes with the 1.7 sdk doesn't use SwDbgSrv.exe and is bundled with it! It will specifically be in the java\jdk1.7.0_80\lib\ folder - at least on windows. Definitely make sure the app


So how do you fix this problem: Download the java 1.7 sdk and use the sa-jdi.jar bundled with it. It will not require SwDbgSrv.exe

Don't download a random sa-jdi.jar from a random website.


I guess this is technically a non-answer because I have no idea how to start SwDbgSrv.exe in windows 7 :/

nmu
  • 1,442
  • 2
  • 20
  • 40