This content has been marked as final.
Show 3 replies
-
1. Re: How to ignore persistence unit loading
jaikiran Jun 22, 2009 3:29 AM (in response to kariem)Where in the WAR file is this jar containing persistence.xml located? As far as i know, the WEB-INF/lib folder of an WAR is not scanned for deployments. So that should have skipped the persistence unit from deploying. But i will have to look at this once more to see if that's not how its expected to behave. In the meantime, please post the output of
jar -tf myapp.war
where myapp.war is the name of your war file. Also in the output, please let us know the name of the persistence unit jar which is being picked up. -
2. Re: How to ignore persistence unit loading
kariem Jun 22, 2009 4:35 AM (in response to kariem)Thank you for taking the time to look at this.
"jaikiran" wrote:
Where in the WAR file is this jar containing persistence.xml located? As far as i know, the WEB-INF/lib folder of an WAR is not scanned for deployments. So that should have skipped the persistence unit from deploying. But i will have to look at this once more to see if that's not how its expected to behave.
The JAR containing the persistence unit is located in WEB-INF/lib/xxx.jar.
According to the EJB 3 persistence spec (JPA 1.0) section 6.2, the following location may contain the root of a persistence unit (root means the jar file or directory whose META-INF directory contains the persistence.xml):- an EJB-JAR file
- the WEB-INF/classes directory of a WAR file
- a jar file in the WEB-INF/lib directory of a WAR file
- a jar file in the root of the EAR
- a jar file in the EAR library directory
- an application client jar file
That means that the persistence unit should be scanned with this type of packaging (item 3 in the list above).
Is there a way in JBoss (or generally in JEE) to prevent this scanning?
Thank you,
Kariem -
3. Re: How to ignore persistence unit loading
jaikiran Jun 22, 2009 8:30 AM (in response to kariem)I don't know of any override to prevent this scanning.
One way i can think of is to add a JBoss specific descriptor (jboss-structure.xml) to the jar containing the persistence.xml. But that would require changing that jar file (which is as good as removing or renaming the persistence.xml).