Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8496

NameNotFoundException during JNDI resource lookup

    XMLWordPrintable

Details

    Description

      Our servlet 2.5 app uses jndi lookup for the database (using Spring). The name in oracle-ds.xml is jndi/database and in the logs upon startup we get the following line:

      [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/database' to JNDI name 'java:jdbc/database'

      In our web.xml, we have the following:

      <resource-ref>
      <res-ref-name>jdbc/database</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      <mapped-name>java:jdbc/database</mapped-name>
      </resource-ref>

      When the app starts and tries to lookup jdbc/database in the Spring bean, it throws an exception:

      Caused by: javax.naming.NameNotFoundException: jdbc not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
      at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
      at org.jnp.server.NamingServer.lookup(NamingServer.java:396) [:5.0.5.Final]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
      at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_21]

      When I do the lookup after the app is initialized, in a JSP, the same lookup returns the correct object.

      So it seems like during initialization, the ENC-JNDI-style lookup (java:comp/env/...) doesn't work anymore, when they used to work in M4...

      It only does this on M5 - M4 works fine. Both untouched extracted downloads, with the oracle-jdbc driver in server/default/lib and oracle-ds.xml in server/default/deploy.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kccoyote_jira K C (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: