Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attaching Java VisualVM for CPU-Profiling leads to JVMTI error 66

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.

like image 778
chrisstr Avatar asked Dec 25 '12 21:12

chrisstr


1 Answers

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.

like image 67
Tomas Hurka Avatar answered Sep 28 '22 06:09

Tomas Hurka