Discussion:
[jboss-user] [JNDI and Naming] - container independent datasource jndi name in persistence.xml
Jean-Philippe Steck
2013-04-15 15:05:44 UTC
Permalink
Jean-Philippe Steck [https://community.jboss.org/people/jpsteck] created the discussion

"container independent datasource jndi name in persistence.xml"

To view the discussion, visit: https://community.jboss.org/message/808396#808396

--------------------------------------------------------------
Hello,

I'm setting up a prototype application that has to be container independent, as far as possible.
I started with Jboss-as-7.1.1, and now I'm trying to migrate this prototype to Glassfish 3.

First problem I found is the jndi name of the datasource used in my persistence.xml file.
In JBoss, I have declared a datasource with the jndi name "java:jboss/datasources/MyDS" in standalone.xml. And I use that name "java:jboss/datasources/MyDS" in persistence.xml.
Now in Glassfish, the declared datasource is "jdbc/MyDS". If I change my persistence.xml to "jdbc/MyDS", everything works.
But I can't set a jndi name with a ":" in Glassfish, so I have to touch something to the JBoss side.

But how can I use the same persistence.xml file for both application server ?

What I've done is to change the datasource definition in jboss standalone.xml :
I defined a "java:/jdbc/MyDS" datasource with use-java-context="false"

And now it's working on both JBoss and Glassfish with the same exact persistence.xml file, having the jta-datasource set to "jdbc/MyDS".

My question : is it the right way to achieve this portability ?
What is the exact consequence of use-java-context=false ? I read that it makes the datasource available to an external client. Does it implies security issues ?

My next step will be to test the portability of using a JMS Queue, and then other app server.
Has anyone such experience to share about application server portability ?

Thanks
--JPS
--------------------------------------------------------------

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

Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]
Loading...