Hi DeanoUK,

     I have the same problem as yours and I've looked for 2 days with no 
concrete answer. My structure is quite like yours - I have several ejb jars 
(without the persistence.xml ) registered in an ear and I have an extra 
mypu.jar which does not contain the entity classes - only the persistence.xml. 
Why is this as such? I have a large project with several ejb modules and some 
are re-usable entities which must be packaged separately. I must share a 
persistence.xml because  entities from one module depend on the reusable 
classes - I cannot have several persistence.xml in each entity's jars. I must 
register the ejb jars under the ear because there is no other way for it to be 
accessed remotely this way - "earname/MyService/remote".  This is fine and it 
works. The problem is my entities are inside the entity jars and I cannot scan 
it using the jar-file syntax as pointed :
     

  |        <jar-file>../myjar.jar</jar-file>
  | 

    Why? Because this is only true if the entity classes are under mypu.jar but 
- it is outside this jar. If you omit the "../" the jar files must be located 
in the bin directory. I have several solutions to workaround this:  

     1. In the jar-file, really specify the absolute path. i.e., 
/jbossroot/server/default/deploy/myear.ear/thejar.jar. This is not a great 
solution because it is not portable. Ideally it should be relative path. Unless 
we can specify a special url handler that points to the ear like a 
"resourceloc://myear.ear" for example, this might be better, or if the 
persistence.xml can support property substitution, this can work too like 
${mypath}/jarfile.jar.   

    2. Do not use jar-file, use explicit declaration of classes. I have not 
tried it but I think this should work. The only problem is - I have several 
entities and it might be hell to register it one by one. Also, if I refactor, 
it might be too unwieldy.

    3. Have a separate package for entities and stateless session beans(SSB). 
The entities will be under mypu.jar, while the stateless session beans  will be 
reigstered as ejb module. On second thought, how do I access the entities from 
the SSB? I have not tried this path.

    4. Only mypu.jar will be registed in the ear, and all other jars under it 
referenced with jar-file in the persistence.xml. It deploys cleanly but the 
problem, like I mentioned, I cannot access the statless session beans as an 
ear. 

    5. All classes are exploded and packaged only in one jar. This is my 
current setup and the reason why I am hassling myself today for a better 
solution. 

    I hope there is a better way of doing this.

Cheers,

Elmo 
 






 




 


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149381#4149381

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149381
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to