users@glassfish.java.net

Java Persistence and ClassLoaders

From: <glassfish_at_javadesktop.org>
Date: Sat, 08 Dec 2007 17:15:40 PST

I've been trying to get some sample code up and running on Glassfish with an alternative JPA implementation that I've been working on for the past few months, based on an existing ORM solution (with key descriminating features not available in the other open source solutions)

I am experiencing difficulties with the clasloader mechanism at present: it seems that classes marked @Entity are not available on the main application classpath.

The approach to ORM is perhaps somewhat unique in that it depends heavily on code generation and we've chosen an original route that leverages both code generation and bytecode enhacement to implement the spec.

As a result there are a number of generated classes that need to be loaded but are not originally part of the client code. They are however referenced by the generated class files which means that as soon as these classes are loaded, I get a class not found exception even though these classes are available on the entity classpath (rather than the application classpath).

I guess the fundamental question here is: why is the main application classloader unable to find classes that are part of the entity classes. Or alternatively, why is the main application classloader unable to read entity classes which only seem to be loadable via the class loader returned from PersistencUnitInfo?

Any guidance much appreciated.
[Message sent by forum member 'dawidcha' (dawidcha)]

http://forums.java.net/jive/thread.jspa?messageID=249199