aspose file tools*
The moose likes JBoss/WildFly and the fly likes JBoss Datsource Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss Datsource Issue" Watch "JBoss Datsource Issue" New topic
Author

JBoss Datsource Issue

Anu Wadhwa
Greenhorn

Joined: Jul 28, 2009
Posts: 4
Hi,

I need to deploy multiple enterprise applications on JBoss which define their own datasource with the same jndi-name jdbc/appSM. I defined the datasource as follows in one of the EAR

I have oracle-ds.xml in my app.ear/META-INF.
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/appSM</jndi-name>
<connection-url>jdbcracle:thin:@wer:1521:hh760</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>op$app</user-name>
<password>app</password>
<exception-sorter-class-
name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</data

jboss-web.xml in webgui.war/WEB-INF dir
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/appSM</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/jdbc/appSM</jndi-name>
</resource-ref>
</jboss-web>

In WEB-INF/web.xml,
<resource-ref>
<description>Oracle Datasource</description>
<res-ref-name>jdbc/appSM</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>

The above works fine. Now if I try to use the same jndi-name again in another EAR I get an error that the resource is already bound. Can anyone tell me how can I make a datasource local to the application? Basically I want the datasource to be visible only within the Enterprise app.

Thanks !!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

The jndi-name of the datasource is always global and hence has to be unique within a server. You won't be able to deploy 2 datasources with the same jndi name on the same server.


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss Datsource Issue