5

When using VisualVM for cpu-profiling of my application, I run into the error

"Profiler Agent Error: with message: Redefinition failed with error 66".

Upon that, it copies all the class-files from the build path to the location I've started the application from.

I tried to find some information on it, the error code means (According to JVMTI-documentation):

JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED (66)
A direct superclass is different for the new class version, or the set of directly implemented interfaces is different.

As profiling usually works in my environment (Java build 1.7.0_09-b05, Fedora 17 64-bit). I've tried "-Xshare:off" as said in the Visualvm-docs, without any effect.

As this is the only Java-SE application I'm experiencing this problem with, it seems that it is somehow related to the libraries I'm using. The following are in my classpath:

  • Log4j 1.2.17
  • Apache OpenJPA 2.2.1
  • Commons Configuration 1.9
  • Commons Pool 1.6
  • Postgresql 9.1-901jdbc4
  • imgscalr-lib-4.2

Can anyone see a correlation between the libraries and the error? I really don't have an idea anymore.

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
chrisstr
  • 53
  • 1
  • 5
  • JPA implementations tend to perform bytecode instrumentation (needed to support things like lazy loading). if its not too much work, try switching JPA providers? – radai Dec 26 '12 at 05:50
  • Openjpa is nested to deep and because of the (from my information) unique handling of detaching / attaching managed entities, it's unfortunately not possible to switch it. – chrisstr Dec 29 '12 at 11:47

2 Answers2

5

It looks like this can be caused by JPA. You can use Sampler instead of Profiler. Another possibility is to define root methods and instrumentation filter so that classes instrumented by JPA are not profiled by VisualVM. See Profiling With VisualVM, Part 1 and Profiling With VisualVM, Part 2 to get more information about profiling and how to set profiling roots and instrumentation filter.

Tomas Hurka
  • 6,723
  • 29
  • 38
  • Thanks for your hint - sampling runs without problems. Actually (shame on me) I always thought that I was doing what sampling does when I was using the profiling option. – chrisstr Dec 29 '12 at 11:49
0

A small addition: I had the same error message when profiling an application that uses OpenJPA. The errors seem to go away after simply clicking "OK" in each error dialog as long as you don't shut down the application.

So you can simply press the button to reset the collected results and run the code again. E.g. by running it in a loop and using new Scanner(System.in).nextLine() or through a button click in a UI.

Henno Vermeulen
  • 1,495
  • 2
  • 15
  • 25
  • Note! Unfortunately JVisualVM does not directly show method calls in the JPA entities. Depending on what you want to achieve this may or may not be a problem. – Henno Vermeulen Apr 22 '15 at 09:30