[jboss-user] [JNDI/Naming/Network] - Configuring a datasource for web application

jgalzic do-not-reply at jboss.com
Wed Sep 27 00:29:14 EDT 2006


I'm a little confused on how I can get a datasource hooked up via JNDI for my web application.  I'm used to working on Tomcat and to configure the JNDI, it was a matter of dropping an xml file into the server's conf directory but I'm having a difficult time getting my app to work inside JBoss.

I have my web.xml that refers to the JNDI resource name as such:

    <resource-ref>
      
        Resource reference to a factory for java.sql.Connection
        instances that may be used for talking to a particular
        database that is configured in the server.xml file.
      
      <res-ref-name>jdbc/myDataBase</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>


I also have a jboss-web.xml which contains:

<jboss-web>
    <resource-ref>
        <res-ref-name>jdbc/myDataBase</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:/myDataBase</jndi-name>
    </resource-ref>
</jboss-web>


However, when Jboss starts up and loads my war file, it tells me that: 
org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: jdbc/myDatabase has no valid JNDI binding. Check the jboss-web/resource-ref.)

Is there some other file I need to configure?Can someone tell me what needs to be done to associate my datasource via JNDI?

Thanks
Justin

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974398#3974398

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974398



More information about the jboss-user mailing list