0 Replies Latest reply on Nov 1, 2006 11:35 PM by kalaimathi

    NameNotFoundException:(jndi name) not bound

    kalaimathi

      hi,
      im using jboss4.0.1 with MyEclipse3.0.8.
      im trying to configure jboss with db2 and also looking up jndi name..
      for this i did some of the procedures.
      in db2-ds.xml i mapped as


      <local-tx-datasource>
      <jndi-name>DB2DS</jndi-name>
      <connection-url>jdbc:db2://thapovan1:50000/EMPLOYEE</connection-url>
      <driver-class>COM.ibm.db2.jdbc.DB2Driver</driver-class>
      <user-name>administrator</user-name>
      thapovan
      <min-pool-size>0</min-pool-size>


      <type-mapping>DB2</type-mapping>

      </local-tx-datasource>

      In login-config.xml file i mapped as

      <application-policy name = "DB2DbRealm">

      <login-module code ="org.jboss.resource.security.ConfiguredIdentityLoginModule"

      flag = "required">
      <module-option name = "principal"></module-option>
      <module-option name = "userName"></module-option>
      <module-option name = "password"></module-option>
      <module-option name ="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DB2DS

      </module-option>
      </login-module>

      </application-policy>


      In jboss-web.xml i mapped as


      <jboss-web>
      <resource-ref>
      <res-ref-name>DB2DS</res-ref-name>
      <jndi-name>java:DB2DS</jndi-name>
      </resource-ref>
      </jboss-web>


      In web.xml


      <web-app>
      <resource-ref>
      DB Connection
      <res-ref-name>DB2DS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </web-app>


      and finally in my java code im looking up jndi name as

      java.util.Properties pro=new java.util.Properties();
      pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      pro.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      pro.put(Context.PROVIDER_URL, "localhost:1099");

      ctxt=new InitialContext(pro);
      System.out.println("context "+ctxt);
      DataSource ds = (DataSource)ctxt.lookup("java:DB2DS");

      DB2DS is my jndi name.i dont know where am i making mistake..will you please give me the solution for this..

      thanks and regards,
      kalaimathi