1 Reply Latest reply on Oct 28, 2004 1:02 AM by raist_majere

    JNDI  Binding error

    mtembene

      Hi all

      It's been a long time since I worked with java and I have never worked with JBoss or JNDI before so please bear with me.

      I am trying to configure oracle-ds.xml, web.xml and jboss-web.xml so that I can use JNDI to get a datasource object. (Note that I am not using EJB's just servlets and jsp's )

      hear is a copy of my oracle-ds.xml file with connection bits stripped out

      <?xml version="1.0" encoding="UTF-8"?>


      <local-tx-datasource>
      <jndi-name>jdbc/SampleDS</jndi-name>
      <connection-url></connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name></user-name>

      </local-tx-datasource>


      Here is my jboss-web.xml file


      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
      <resource-ref>
      <res-ref-name>jdbc/SampleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <jndi-name>jdbc/SampleDS</jndi-name>
      </resource-ref>
      </jboss-web>


      Here is my part of my web.xml file


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


      When I go to deploy my ear file I get several error messages regarding JNDI including

      org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: jdbc/SampleDS has no valid JNDI binding. Check the jboss-web/resource-ref.)

      and


      MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
      ObjectName: jboss.web.deployment:war=sample.war,id=-2112006021
      state: FAILED
      I Depend On:
      Depends On Me: MBeanException: org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: jdbc/SampleDS has no valid JNDI binding. Check the jboss-web/resource-ref.)
      Cause: org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: jdbc/SampleDS has no valid JNDI binding. Check the jboss-web/resource-ref.)
      ObjectName: jboss.j2ee:service=EARDeployment,url='sample.ear'


      If anyone could offer any suggestions as to what I am doing wrong it would be greatly appreciated.

      Thanks



        • 1. Re: JNDI  Binding error
          raist_majere

          You have to put the correct JNDI name of the Datasource on jboss-web.xml. In your case, your jboss-web.xml file should be:

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss-web>
          <resource-ref>
          <res-ref-name>jdbc/SampleDS</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <jndi-name>java:/jdbc/SampleDS</jndi-name>
          </resource-ref>
          </jboss-web>