Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Semi-OT] JBoss 3.0 - changing the JNDI name of an Oracle Datasource from OracleDS to comp/env/jdbc/DataSource



This is a J2EE "201" question (as opposed to "101" :-)

You should probably have asked it on the JBoss forums (jboss.org) or the jboss-user mailing list.

Nevertheless, to satisfy the curious onlookers, here goes:

The java:comp/env JNDI namespace is a *component* namespace and is visible only from within individual EJBs. Your "java:comp/env/jdbc/something" is hardcoded into your EJB. J2EE configuration provides a way to decouple the hard coded name from the physical name of the resource.

The EJB descriptor in your ejb-jar.xml needs a <resource-ref> element. For example:

<session >
<description>My JDBC Client Bean</description>
<ejb-name>MyJDBCClient</ejb-name>

... various interface descriptors ...

<resource-ref>
<res-ref-name>jdbc/something</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

</session>

In the JBoss case, the resource-ref above gets mapped to the real datasource in the jboss.xml file with a <resource-manager> element:

<resource-manager>
<res-name>jdbc/something</res-name>
<res-jndi-name>java:OracleDS</res-jndi-name>
</resource-manager>

I highly recommend xdoclet <http://xdoclet.sourceforge.net/> for managing this stuff for you.

Steve Coy


On Friday, October 4, 2002, at 05:03 PM, Thorbjxrn Ravn Andersen wrote:

My apologies for being a bit off-topic, but this is a real problem for us, and I develop on OS X :)

We are developing an application where we are testing several application servers, since we have a strong desire to avoid vendor lock-in. The JBoss sample for a Oracle DataSource registers it at java:/OracleDS, where a more appropriate place would be under java:comp/env/jdbc/something. Various attempts at getting it there by doing the "obvioius" changes, fails.

Are there a JBoss developer on this list, who has solved my problem and has a oracle-service.xml which registers a Oracle DataSource under comp/env in JNDI?
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >[Semi-OT] JBoss 3.0 - changing the JNDI name of an Oracle Datasource from OracleDS to comp/env/jdbc/DataSource (From: Thorbjørn Ravn Andersen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.