users@glassfish.java.net

Re: RE: Re: Surprising JPA (Toplink) Behaviour (glassfish v1 UR1)

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Mar 2007 11:51:51 PST

What type of container are you running in? Have you considered using a Container Managed Entity Manager instead of an Application Managed one? The exception you are seeing is most likely the result of a race condition between two or more threads attempting to initialize the Persistence Unit. Persistence Units are lazily initialized when Application Managed and it appears from looking at the code that when deployed without the java agent (ie. in a container) a race condition exists that can result in this exception. If you can stagger the calls to the first createEntityManager() call or call createEntityManager() when you first create the EMF then discard the EntityManager the race condition should be removed. I have filed issue numbered 2640.
--Gordon
[Message sent by forum member 'gyorke' (gyorke)]

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