On May 24, 2011, at 2:36 AM, Romain Manni-Bucau wrote:

> Hi,
> 
> i think it is a bug of the jdk something like now (since 1.6 u18 or u17) it
> is impossible to load an inner class before the containing class. Maybe
> doing a loadClass(StartupServiceEJB.class.getName()) before can help.

I'm not sure when the problem was introduced, and I've not seen an inner class 
load problem, but would basically agree that this is fundamentally a JSE issue. 

Refining/adding additional information to David's comments:

We've run into a similar problem in Geronimo where classfile transformation 
could cause redundant/cyclical define class calls on the same thread for the 
same class. This would only happen for Annotations and Enums. Basic flow was 
(1) defineClass() -> (2) OpenJPA transform() -> (3) defineClass(). The 
defineClass() in (3) would work. But the defineClass in (1) ends up throwing a 
LinkageError.

The Felix classloader detects a cyclical load and avoids the LinkageError 
failure. Very recent builds of Equinox 3.7 now detect the same situation. In 
both environments, the defineClass() in (3) now throws a ClassNotFoundException 
(IIRC). Which is ok. We really don't need to transform the classes, anyway.

In Geronimo we had a work around for the issue by catching the LinkageError 
thrown by (1) and simply retrying the defineClass() - which will now work (or 
returns without throwing an exception).

--kevan

Reply via email to