NoClassDefFoundError when running FindClass in class prepare callback

Vincent Liu vinceliu at
Mon Oct 19 02:22:52 PDT 2009

Hi list,

I have a very simple JVMTI agent library running in Java, which is
registering on 3 callbacks, ClassFileLoadHook, ClassPrepare and ThreadEnd.
Currently I'm having a problem with invoking FindClass in the class prepare
callback, which fails with a message of:

  Error occurred during initialization of VM
  java.lang.NoClassDefFoundError: Could not initialize class

AFAIK, the problem seems to be triggered by the JNI FindClass call. I've
checked the specification and it seems to suggest it's ok to make JNI calls
by the time the ClassPrepare events are triggered. Is there something that I
may be doing wrong? If I do not register for the ThreadEnd event, the
problem goes away. Maybe that may help in identifying the problem.

I've attached the minimum source of the simple agent that replicates the
problem. I'm running the agent on Ubuntu Linux, with the following version
of Java:

  java version "1.6.0_0"
  OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu11)
  OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

Let me know if there are additional information I can supply to help.

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simpleagent.tar.gz
Type: application/x-gzip
Size: 1911 bytes
Desc: not available
Url : 

More information about the hotspot-runtime-dev mailing list