I think the answer may lie in better saying what you mean by "map a generic datasource  to a specific datasource"  I don't know what this means.

David Brady wrote:

First, I'll summarize any answers I get and post them to jboss-users.

I'm trying to map a generic datasource (as referenced in my code) to a
specific datasource via jboss-web.xml.  It ain't working for me, and I
can't see why not...  I *do* know that I'm missing something, just can't
figure out what is missing!

Code:

InitialContext initialCtx = new InitialContext();
DataSource ds = (DataSource) initialCtx.lookup("GenericDS"); // or many
other permutations

web.xml:

    <resource-ref>
        <description>Generic DS</description>
        <res-ref-name>GenericDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

jboss-web.xml:

   <resource-ref>
     <res-ref-name>GenericDS</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <jndi-name>java:/jdbc/SpecificDS</jndi-name>
   </resource-ref>

Jboss.jcml

   <mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=jdbc/SpecificDS">
      <attribute name="PoolName">jdbc/SpecificDS</attribute>
      ...

STARTUP: I see the following in the log:

INFO  jdbc/SpecificDS jdbc/SpecificDS - XA Connection pool
jdbc/SpecificDS bound to java:/jdbc/SpecificDS
...
DEBUG EmbeddedCatalinaServiceSX  - Linking 'GenericDS' to JNDI name:
java:/jdbc/SpecificDS

RUNTIME:

initialCtx.lookup("GenericDS") fails with -
javax.naming.NameNotFoundException: GenericDS not bound

Other variations - just for fun:

Failure  java:jdbc/GenericDS (GenericDS not bound)
Failure  java:/jdbc/GenericDS (GenericDSnot bound)
Failure  java:GenericDS (GenericDS not bound)
Failure  java:/GenericDS (GenericDS not bound)
Failure  GenericDS (GenericDS not bound)
Failure  /GenericDS (GenericDS not bound)
Failure  jdbc/GenericDS (jdbc not bound)
Failure  /jdbc/GenericDS (jdbc not bound)
Failure  java:SpecificDS (SpecficDS not bound)
Failure  java:/SpecificDS (SpecficDS not bound)
Failure  SpecificDS (SpecficDS not bound)
Failure  /SpecificDS (SpecficDS not bound)

These, of course, work:

Success  java:jdbc/SpecficDS
Success  java:/jdbc/SpecficDS

I thought I had a good handle on this for EJBs, but am unable to pull
this together for a servlet.

Thoughts? Pointers?  Anything?

Thanks,
David

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

--
Greg Turner, JBoss Authorized Consultant

Tiburon Enterprise Systems
http://www.tiburon-e-systems.com
Box 1171
Tiburon, CA 94920
415-332-3363
 

Reply via email to