Tuesday, 1 October 2013

Portable JNDI name for DataSource

Portable JNDI name for DataSource

I have a EJB with field
@Resource(lookup = "jdbc/sampleDS")
private DataSource ds;
and persistence.xml with entry
<jta-data-source>jdbc/sampleDS</jta-data-source>
I want to make the application easy portable across different Java EE
servers. But in JBoss JNDI name has to start with java:/ or java:jboss/.
At the same time Glassfish doesn't like symbol ':'. How to achieve
portability? I tried to set attribute use-java-context="false" for data
source instandalone.xml, but it didn't help me.
Thanks in advance.

No comments:

Post a Comment