[jboss-user] [EJB 3.0] - How to package a persistent archive for use in JBoss and Tomcat standalone

Gonne Martens do-not-reply at jboss.com
Wed Jun 30 11:58:05 EDT 2010


Gonne Martens [http://community.jboss.org/people/gonne] created the discussion

"How to package a persistent archive for use in JBoss and Tomcat standalone"

To view the discussion, visit: http://community.jboss.org/message/550411#550411

--------------------------------------------------------------
Hi all,

I am trying to build a persistent archive (Hibernate 3.5 as JPA provider) containing entities that should be usable in different applications.

My first use case is a web application running in a standalone Tomcat 5.5 environment. The JNDI reference to the datasource in the persistence.xml for that environment must be relative to the JNDI ENC, e.g.:

<jta-data-source>java:/comp/env/jdbc/MyDatabase</jta-data-source>


My other use case is an enterprise application for JBoss 6. The JNDI reference to the database in my JBoss deployment is e.g. java:/MyDatabase
If I use the persistent archive with the same persistence.xml as in my first use case the datasource can not be found.

How can I override the reference to the datasource without changing the persistent archive?
Or is it possible to create a link in JNDI?

I tried to remove the persistence.xml from the persistent archive (located in ear/lib) and created a new persistence.xml in my ear referencing the persistent archive by using the jar-file element and the datasource java:/MyDatabase. That works in JBoss 6, but I do not know how to deploy that in Tomcat 5.5. The corresponding method by usign the jar-file element does only work in Tomcat by using an absolute path for the persistent archive what I do not prefer.

Can anyone help?

Thanks,
Gonne

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

Reply to this message by going to Community
[http://community.jboss.org/message/550411#550411]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100630/0e91ced7/attachment.html 


More information about the jboss-user mailing list