3 Replies Latest reply on Mar 30, 2009 1:23 PM by jnl1

    NameNotFoundException 'employeePerks' not bound

    jnl1

      hi all...

      i'm porting an application that works fine in Tomcat 6.6 to JBoss 4.2.3.GA. Using jdk 1.6.

      Here's my context.xml:

      
      <Context path="/employeePerks"
       debug="0"
       reloadable="true">
      
       <Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
       connectionURL="xxx"
       alternateURL="xxx"
       roleBase="xxx"
       roleSubtree="false"
       roleName="xxx"
       roleSearch="uniqueMember={0}"
       userBase="xxx"
       userSubtree="true"
       userSearch="uid={0}" />
      
       <Resource
       name="jdbc/employeePerks"
       auth="Container"
       type="javax.sql.DataSource"
       maxActive="100"
       maxIdle="30"
       maxWait="10000"
       username="xxxx"
       password="xxxx"
       defaultAutoCommit="false"
       removeAbandoned="true"
       removeAbandonedTimeout="60"
       logAbandoned="true"
       validationQuery="xxxx"
       driverClassName="xxxx"
       url="xxxx"/>
      
      
      </Context>
      
      


      My web.xml:

      
      <resource-ref>
       <description>DB Connection</description>
       <res-ref-name>jdbc/employeePerks</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      
      


      My datasource fiile:

      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <datasources>
       <local-tx-datasource>
       <jndi-name>employeePerks</jndi-name>
       <connection-url>xxxx</connection-url>
       <driver-class>xxxx</driver-class>
       <user-name>xxxx</user-name>
       <password>xxxx</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       </local-tx-datasource>
      
      </datasources>
      
      
      


      My jboss-web.xml:

      
      <?xml version="1.0" encoding="UTF-8" ?>
      
      <jboss-web>
       <security-domain>/employeePerks</security-domain>
       <resource-ref>
       <res-ref-name>jdbc/employeePerks</res-ref-name>
       <jndi-name>java:/employeePerks</jndi-name>
       </resource-ref>
      
      </jboss-web>
      
      


      The application deploys fine, but when trying to login, I get this error:

      
      13:57:44,619 ERROR [JBossSecurityMgrRealm] Error during authenticate
      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: employeePerks not bound]
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:488)
       at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:257)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.naming.NameNotFoundException: employeePerks not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1209)
       ... 15 more
      13:57:49,493 INFO [Server] Runtime shutdown hook called, forceHalt: true
      


      can anyone help out? thanks



        • 1. Re: NameNotFoundException 'employeePerks' not bound
          jaikiran

          What's your datasource file named and where is it placed? In JBoss, you don't have to change/add the context.xml for configuring datasources. Datasources in JBoss are configured through *-ds.xml files placed in the deploy folder of JBoss. See these wiki:

          http://www.jboss.org/community/docs/DOC-9498

          http://www.jboss.org/community/docs/DOC-9328

          • 2. Re: NameNotFoundException 'employeePerks' not bound
            jnl1

            thanks for the suggestion. my datasource file is in my $JBOSS_HOME/server/default/deploy dir and is called employeePerks-oracle-ds.xml. not sure what you are referring to about the context.xml? the war works fine in tomcat 6.0.

            to port over to jboss, all i did was add the jboss-web.xml file which looks like:

            
            <?xml version="1.0" encoding="UTF-8" ?>
            
            <jboss-web>
             <security-domain>/employeePerks</security-domain>
             <resource-ref>
             <res-ref-name>jdbc/employeePerks</res-ref-name>
             <jndi-name>java:/employeePerks</jndi-name>
             </resource-ref>
            
            </jboss-web>
            
            


            not sure where the problem could be?...thanks



            • 3. Re: NameNotFoundException 'employeePerks' not bound
              jnl1

              i'm not sure if this matters but my datasource.xml (for spring) is defined as follows:

              
              <beans>
               <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
               <property name="jndiName">
               <value>java:comp/env/jdbc/employeePerks</value>
               </property>
               </bean>
              </beans>
              
              


              thanks