persistence@glassfish.java.net

Re: persistence.xml location with javaagent

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 15 May 2006 10:45:41 -0400

Hello Onur,
   The TopLink agent is unable to find the Persistence Unit because of
the classloader structure used in the Tomcat web container. The
Persistence Unit is not on the system classpath but is kept within the
'application' class path to provide for isolation and the agent has no
access to this classloader. Without using the agent your application
will still function normally, only lazy loading of *-one relationships
will not be active, they will be eagerly loaded.
   In a future build from
https://glassfish.dev.java.net/downloads/persistence/JavaPersistence.html
TopLink will have 'static weaving' functionality, to allow you to
process the Persistence Unit before deploying. The specifics of static
weaving and when it will be released are still under discussion.
   -Gordon


Onur Tokan wrote:
> Hello,
>
> I am using glassfish persistence with tomcat. My persistence.xml is
> located under WEB-INF\classes\META-INF directory which works fine.
> However when I start tomcat with
>
> -javaagent:"MYDIRECTORY\toplink-essentials-agent.jar" it gives
> javax.persistence.PersistenceException: No Persistence provider for
> EntityManager named pu1.
>
> Any ideas?
>
> Best regards,
>
> Onur
>
> PS: using latest build of glassfish persistence api bundle