There have been a few emails to this list about classpath issues when enhancing on Glassfish. I don't think there's a definitive guide to getting automatic enhancement working though, and the general consensus is to use build time enhancement.
That said, if you can resolve the classpath problem you're currently hitting, you'll probably be okay. There are two kinds of automatic enhancement - a 'good' kind which involves bytecode insertion triggered by the JRE or Application Server, and a 'bad' kind which dynamically creates a subclass for your entities. It looks like you're hitting the 'good' kind but some classloader issues are blocking you. Short answer, I'd use build time enhancement unless there's a compelling reason not to. Hope this helps, -mike On Sat, Sep 10, 2011 at 8:29 AM, koenr <k...@teutenhof.be> wrote: > I deployed an .ear to GlassFish with the following structure: > > (Result from: jar tf MyProject.ear) > > META-INF/ > META-INF/MANIFEST.MF > lib/ > lib/openjpa-all-2.1.1.jar > lib/MyProject-pojo.jar > MyProject-ejb.jar > MyProject-ws.war > > Both MyProject-ejb.jar and MyProject-ws.war have a MANIFEST.MF file with a > "Class-Path: lib/MyProject-pojo.jar" in them. > > However, when I deploy this .ear archive to GlassFish (3.1.1), I receive an > error: > > [...] > at > > org.apache.openjpa.enhance.PCClassFileTransformer.transform0(PCClassFileTransformer.java:144) > ... 77 more > Caused by: java.lang.ClassNotFoundException: my.package.MyClass > [...] > > Apart from the error message, which I'm still investigating, it looks as if > GlassFish indeed automatically tries to enhance my entities. > > Can I safely ignore vague warnings on the web NOT to thrust this "auto > enhance feature", or is there a particular reason I should still enhance > the > entities myself at build time (when deploying to GF3)? > > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/Enhancement-necessary-in-GlassFish-3-tp6778727p6778727.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >