See reply inline...
glassfish_at_javadesktop.org wrote:
> 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 am confused. Who is the they here? Who loads the generated classes?
> I get a class not found exception even though these classes are available on the entity classpath (rather than the application classpath).
>
Please explain what you mean by entity classpath and 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?
>
The class loader returned by PersistenceUnitInfo is the application
class loader for the application containing the persistence unit that is
being deployed. Its parent is a class loader that is used by the server.
That parent class loader can't load any classes that are part of your
application ear/war/jar file.
Where are you installing your JPA provider? Is it
$GlassFishHome/domain1/lib or $GlassFishHome/lib? If yes, remove from
there and try bundling your JPA provider implementation along with the
persistence unit and deploy the app?
Siva's classloader in GlassFish blog [1] tries to explain classloading
in GlassFish. Take a look at it.
Thanks,
Sahoo
[1]
http://blogs.sun.com/sivakumart/entry/classloaders_in_glassfish_an_attempt
> Any guidance much appreciated.
> [Message sent by forum member 'dawidcha' (dawidcha)]
>
> http://forums.java.net/jive/thread.jspa?messageID=249199
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>