[jboss-user] [EJB 3.0] New message: "Persistence unit issues when migrating to JBOSS 5.1.0"

Dragos Bobes do-not-reply at jboss.com
Thu Jan 7 15:56:06 EST 2010


User development,

A new message was posted in the thread "Persistence unit issues when migrating to JBOSS 5.1.0":

http://community.jboss.org/message/518847#518847

Author  : Dragos Bobes
Profile : http://community.jboss.org/people/dbobes

Message:
--------------------------------------------------------------
Hello everyone,
 
I have a seam application that used to run fine in JBOSS 4.2.3 and the ear had the following structure:
 
myapp.ear
+- lib/ 
| +- extejbmodule.jar
| +- ...
+- mywebmodule.war
+- myseammodule.jar
| +-META-INF/ 
| | +- persistence.xml
| +- ... hibernate entities ...
| +- ... ejbs ... | +- ...
+- ...

 
extejbmodule.jar has several classes that are injected (using @PersistenceContext) with the default persistence unit defined in the myseammodule.jar. When the ear is deployed to 5.0, due to the new persistence unit scope approach, the persistence unit is not visible to the extejbmodule.jar and I get :
Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext at 2127445{....
I created a new jar that only contains the persistence.xml file in its META-INF folder and I placed it in the root of the ear file. The ear structure looks like this now:
 
myapp.ear
+- lib/ 
| +- extejbmodule.jar
| +- ...
+- myseammodule.jar
| +- ... hibernate entities ...
| +- ... ejbs ...
+- persistence.jar
| +-META-INF/ 
| | +- persistence.xml
| | +- ...
+- mywebmodule.war
+- ...

 
And I defined the new module in META-INF/application.xml:
 
   <module>
      <java>persistence.jar</java>
   </module>

 
With this approach both the extejbmodule.jar and the myseammodule.jar can see the persistence unit but the hibernate classes are not scanned for annotations and no entities are mapped. The log entry looks like this:
 
 14:59:51,868 DEBUG [AbstractJarVisitor] Searching mapped entities in jar/par: vfszip:/C:/work/tools/jboss-5.1.0.GA/server/default/deploy/myapp.ear/persistence.jar/ 
 

 
It looks like the ejb container only scans the jar that contains the persistence unit definition.How can I instruct the container to scan the correct jars? Or, if my approach is not correct, what is the best way to have the persistence unit be available in the entire ear scope (available to all modules)?
 
Thanks,
Dragos

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/518847#518847




More information about the jboss-user mailing list