On Fri, Sep 25, 2009 at 5:41 PM, ANTHONY ENNIS <tony.en...@insightbb.com> wrote: > I have a web service that performs a simple database lookup. Unfortunately, > Persistence.createEntityManagerFactory('xyzzy') fails in all cases. > > My aar looks like: > /com > (class files in package format eg com/this/that/x.class) > /META-INF > services.xml > /lib > numerous jars > > I don't know where to put the persistence.xml file. I have tried putting it > everywhere. I keep getting the following error: > > javax.persistence.PersistenceException: No Persistence provider for > EntityManager named xyzzy > at > javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56) > at > javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34) > at > com.papajohns.snapshot.webservice.SurveySubmissionWebService.getSurvey(SurveySubmissionWebService.java:63) > > (etc) > > Or does that error mean something else? >
The only thing really required in your aar is a services.xml . Put your classes under WEB-INF/classes and you should have no problems. Hibernate uses the TCCL (Thread context classloader) so you can't load hibernate there without some tricks - for example what the spring support docs show for hibernate. - R