0 Replies Latest reply on Jan 5, 2003 10:12 PM by venko

    JNDI lookup--Why Jboss does not throw NamingException ?!

    venko

      I am trying to port petstore application.
      in the populateservelt At following place error is occuring.
      private Connection getDBConnection() throws IOException {
      DataSource datasource = null;
      try {
      Hashtable prop = new Hashtable();
      prop.put ("java.naming.factory.url.pkgs",
      "org.jboss.naming:org.jnp.interfaces");
      prop.put ("java.naming.provider.url",
      "jnp://localhost:1099");
      prop.put ("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");
      InitialContext ic = new InitialContext(prop);
      System.out.println("intial context ="+ ic);
      java.util.Hashtable ht = ic.getEnvironment();
      java.util.Enumeration e = ht.elements();
      while(e.hasMoreElements())
      {
      Object o = e.nextElement();
      System.out.println("The key is="+o);
      Object v = ht.get(o);
      System.out.println("value is v= "+v);
      }
      error >>>>>>>> Object myobj =(Object)ic.lookup("java:/comp/env/ejb/customer/Customer");
      System.out.println("the lookup obj is="+myobj);
      datasource = (DataSource) ic.lookup(ESTORE_DATASOURCE);
      System.out.println("Got DS !! it is ="+datasource);
      } catch (NamingException ne) {
      throw new IOException("NamingException while looking " +
      "up DB context : " + ne.getMessage());
      }
      ----
      The lookup is failing and probalbly the reason may be because the values for the objects are null as
      21:13:33,596 INFO [STDOUT] intial context =javax.naming.InitialContext@3dd208
      21:13:33,606 INFO [STDOUT] The key is=org.jnp.interfaces.NamingContextFactory
      21:13:33,606 INFO [STDOUT] value is v= null
      21:13:33,606 INFO [STDOUT] The key is=localhost:1099
      21:13:33,606 INFO [STDOUT] value is v= null
      21:13:33,606 INFO [STDOUT] The key is=org.jboss.naming:org.jnp.interfaces
      21:13:33,606 INFO [STDOUT] value is v= null

      It appears to me that JNDI lookup failure.
      I wonder why Jboss does not throw Naming exception at all !!
      No error messages.The method call simply won't return.
      Any ideas what I need to do.
      Incidenatlly,Weblogic gives very user friendly error messages for similar errors.
      thanks,
      venko.