Try changing your PersistenceContext injection attribute from "name" to "unitName" to refer to your persistence unit.
-greg -----Original Message----- From: Michael Dick [mailto:michael.d.d...@gmail.com] Sent: Thursday, July 15, 2010 2:58 PM To: users@openjpa.apache.org; us...@openejb.apache.org Subject: EXTERNAL: Re: PersistenceUnit null not found Nothing else is jumping out at me so I'm cross-posting to us...@openejb. I'm not sure what PersistenceUnit 'null' means in this context - they might be able to shed some light on the message though. -mike On Thu, Jul 15, 2010 at 10:01 AM, Michael Simons <michael.sim...@optitool.de > wrote: > Hello Mike, > > It's in the META-INF directory of the ejb.jar that I deploy. > We are deploying to a Geronimo AS (2.1.4) that uses openejb-3.0.1. > Might this have been a bug in that version that has been solved since > then. > > Regards, Michael > > Michael Dick schrieb: > > Hi, > > > > Where is the persistence.xml file in your ejb.jar? It should be in > > the META-INF directory. > > > > The container will look for persistence.xml files in the following > > places (per JPA spec): > > In Java EE environments, the root of a persistence unit must be one > > of > the > > following: > > * an EJB-JAR file > > * the WEB-INF/classes directory of a WAR file[80] * a jar file in > > the WEB-INF/lib directory of a WAR file * a jar file in the EAR > > library directory * an application client jar file > > > > In this case the root of the persistence unit is the directory that > contains > > META-INF/persistence.xml, not the directory that contains > persistence.xml. > > > > If you have it in one of the places listed above the OpenEJB should > > be > able > > to find it. > > > > Regards, > > -mike > > > > On Thu, Jul 15, 2010 at 8:13 AM, Michael Simons > > <michael.sim...@optitool.de>wrote: > > > >> Hello, > >> > >> I've declared a persistence-unit named "AtlantisWest" in my > >> persistence.xml, that I reference in my bean by > >> @PersistenceContext(name="AtlantisWest", > >> type=PersistenceContextType.EXTENDED) > >> protected EntityManager entityManager; > >> > >> Can anybody please tell me what might cause the following exception > >> when deploying my bean: > >> > >> Caused by: org.apache.openejb.OpenEJBException: Error building bean > >> 'MapAuxiliaryServiceBw'. > >> Exception: class org.apache.openejb.OpenEJBException: PersistenceU > >> nit 'null' not found for EXTENDED ref 'AtlantisWest': > >> PersistenceUnit 'null' not found for EXTENDED ref 'AtlantisWest' > >> at > >> > org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder > .java:64) > >> at > >> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assem > bler.java:489) > >> ... 52 more > >> Caused by: org.apache.openejb.OpenEJBException: PersistenceUnit 'null' > not > >> found for EXTENDED > >> ref 'AtlantisWest' > >> at > >> > >> > org.apache.openejb.assembler.classic.EnterpriseBeanBuilder.build(Enter > priseBeanBuilder.java:198) > >> at > >> > org.apache.openejb.assembler.classic.EjbJarBuilder.build(EjbJarBuilder > .java:52) > >> > >> > >> Kind Regards, Michael > >> > >> > > > > >