tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Thieu <>
Subject Re: persistence.xml in a Jar in Tomcat Common classloader (ERROR : PersistenceUnit already deployed)
Date Thu, 16 Oct 2008 10:13:07 GMT

Hi David,

Thanks for your anwser.

I allready try including persistence.xml in my webapp.
But this doesn't works because I have Service in service.jar with Annotation
@PersistenceContext under EntityManager.
OpenEJB doesn't find it (because it's defined in the webapp) when it loads
service.jar :
ERROR - FAIL ... MyService:	Missing required persistence.xml for
@PersistenceContext ref "entityManager" to unit "jpa-service"

Even if this has worked, it is not really what I'm after.

Indeed, I will be very interested if "global" persistence units where
managed by OpenEJB.

Thanks in advance,


David Blevins wrote:
> Hi Maxime,
> It should be possible to put the service.jar in the Tomcat lib/  
> directory without a persistence.xml in it and then include that  
> persistence xml in your webapp.  You should be able to include a <jar- 
> file> element in the unit declaration that points to the C:/tomcat6/ 
> lib/service.jar so all the entities will be discovered without having  
> to explicitly list them via the <class> element.  You'd have to  
> include the same persistence.xml in each webapp that wanted to reuse  
> the classes in service.jar.
> Not entirely sure though if that's really what you're after.  We don't  
> currently have any support for "global" persistence units.  Meaning  
> say a persistence unit declared outside of an ear at server level and  
> available to all ears/apps deployed.  It might be something we could  
> add if that's really what you're after.
> -David

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message