2 Replies Latest reply on May 29, 2006 3:40 AM by jaikiran

    Caused by: javax.naming.NameNotFoundException: env not bound

    victorlxd

      Hi. I have a werid problem, I have the oracle data source configuration working under jboss 4.0.1, but it does not work under jboss 3.2.1.

      THe Caused by: javax.naming.NameNotFoundException: env not bound is thrown.

      the applicaiton is delployed as a war file.

      1) The oracle-ds.xml is in the default/deploy.

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

      <local-tx-datasource>
      <jndi-name>RDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@xx.xxx.xxx.xxx:1521:orcl</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>xx</user-name>
      xx
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </local-tx-datasource>


      2) web.xml has the following element defined:
      <resource-ref >
      <res-ref-name>jdbc/RDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      3) jboss-xml has the following element defined:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">

      <jboss-web>

      <context-root>test</context-root>
      <resource-ref>
      <res-ref-name>jdbc/RDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <jndi-name>java:/RDS</jndi-name>
      </resource-ref>
      </jboss-web>

      4) The applicaiton is using the following lines:

      DataSource dataSource =
      (DataSource) new InitialContext(new Hashtable()).lookup("java:comp/env/jdbc/RDS");

      In jboss 3.2.1, it throws exception, and the server log indicatest that
      Caused by: javax.naming.NameNotFoundException: env not bound.

      Sorry if this question has been asked before. Any help would be highly appreciated.

      Thanks