I'm trying to profile a Tomcat application (WS cxf, based on Spring).
I'm using Eclipse Indigo (SR2 32bits), with jrockit-jdk1.6.0_33-R28.2.4-4.1.0 (32 bits).
Tomcat is launched with Oracle JRockit(R) R28.2.4-14-151097-1.6.0_33-20120618-1634-windows-x86_64 with the debugging mode in Eclipse.
With this configuration, I'm using JRockit Mission Control 4.1, with which I can connect to the Jrockit JVM running Tomcat.
At this point, it works.
Now, I set the method profiler to examine my webservices that I invoke with SoapUI ... as I receive the response, there is no invocation logged by Mission Control. In the same time, Mission Control counts the 400 String.toString invocations...
Have you an idea ?
The Method Profiler in the Management Console only counts method invocations for the first class loader it finds. So if your method exists in mulltiple class loaders and you are unlucky the method profiler will miss it.
Thanks for your answer,
Is the order of the classloader can be changed ? or is the Method Profiler will be extended to counts all methods ?
An another question : the Method Profiler find (alone) the methods of my classes, that means it can see all classloaders or it just use the classpath ?
No, the order depends on how the JVM handles them internally. I'm sorry, but the only way to make sure your method invocations gets counted is to make sure that method only exists in one class loader.
Currently the management and monitoring features in JRockit are ported over to Hotspot. If or when the Method Profiler is available for Hotspot it will most likely be able to count method invocations in all class loaders.
If your class is loaded (and it's only available in one class loader) the Method Profiler will see it, regardless of how the JVM finds the class (class path etc).
Ok, Erik, I see. That means that there is at least 2 classloader in the tomcat application that can present my own classes. So the question is now : do I have a way to restrict to 1 the number of classloader ? may be, programmaticly by scanning for all classloader and removing reference to my classes ? Have you already done that ? may have you seen an example in tha way ?
Merci / thanks
I don't know why your class is loaded using multiple class loaders. Maybe you redeployed your application and there are instances left on the heap from a previous deployment? Have you tried restarting Tomcat?
The Memory Leak Detector that comes with Mission Control can be used to inspect the heap. On the Trends Tab you can see the number of class loaders a class has been loaded with. You may have to go into Preferences and lower the threshold so you get to see all classes though.