Hello, I'm a YourKit Java Profiler developer. Our customer have reported that Geronimo 2.0 doesn't start with our profiler agent.
There is a LinkageError on server startup:
java.lang.LinkageError: loader (instance of org/apache/geronimo/kernel/classloader/JarFileClassLoader): attempted duplicate class definition for name: "$javax/naming/Context$$EnhancerByCGLIB$$79faf44d$$FastClassByCGLIB$$e18c505c"
at java.lang.ClassLoader.defineClass1(Native Method)
... 34 more
Looking into this, I have found that the problem is caused by dynamic byte-code instrumentation: we add a special 'static transient boolean' field in some classes and "$javax/naming/Context$$EnhancerByCGLIB$$79faf44d$$FastClassByCGLIB$$e18c505c" is one of them.
It looks like CGLIB somehow watches the classfile changes and causes Geronimo classloader to reload class, modified by our instrumentation.
The problem arises because the names are identical.
You can reproduce the problem with YourKit Java Profiler 6.0.11 http://yourkit.com/download/index.jsp
and geronimo 2.0
To run server with profiler you can just add 2 following lines at the beginning or geronimo startup.bat
set PATH=<path to YourKit Java Profiler install dir>/bin/win32;%PATH%
set JAVA_TOOL_OPTIONS=-agentlib:yjpagent %JAVA_TOOL_OPTIONS%