JNDI look up binding
camiloahm May 18, 2012 5:10 PMHello,
How can I create aliases of the JNDI Names for a datasource?
I created this datasource
<datasource jta="false" jndi-name="java:/prueba2" pool-name="dspruebas" enabled="true" use-ccm="true">
<connection-url>jdbc:sqlserver://dev-camiloh:1433;databaseName=pruebas</connection-url>
<driver>MICROSOFTSQLSERVER</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<security>
<user-name>ww</user-name>
<password>ww</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
I have an application with this persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="Prueba2UN" transaction-type="JTA">
<jta-data-source>prueba2</jta-data-source>
<properties/>
</persistence-unit>
</persistence>
I tried to use the next subsystem
<subsystem xmlns="urn:jboss:domain:naming:1.1">
<bindings>
<lookup name="prueba2" lookup="java:/prueba2"/>
</bindings>
</subsystem>
And I got an exception during service startup DuplicateServiceException, I know that I can use resource-ref in a jboss-ejb3.xml and it works,but what I want is to make a global alias for the jndi of the datasource
Thanks.