5 Replies Latest reply on May 24, 2002 12:55 AM by vickyk

    help! datasource jndi lookup!

    microwin

      My jboss is JBoss-2.4.4_Tomcat-4.0.1 !
      where start jboss ,there is no errors ,and the datasource is bound to java:/DefaultDS!
      but when I lookup the jndi name ,happen errors :
      javax.naming.NameNotFoundException: DefaultDS not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at com.microwin.JbossEjbClient.dbpool(JbossEjbClient.java:48)
      at com.microwin.JbossEjbClient.main(JbossEjbClient.java:60)

      My program is :

      try {
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
      InitialContext initCtx = new javax.naming.InitialContext(p);
      initCtx.lookup("java:/DefaultDS");
      }
      catch (Exception ex) {
      ex.printStackTrace();
      }


      please help me! thanks!

        • 1. Re: help! datasource jndi lookup!
          vickyk

          Hi,
          Did you got the solution ?I am facing the same problem..
          regards vickyk

          • 2. Re: help! datasource jndi lookup!
            davidjencks

            You can't access a datasource from outside the jboss vm. You can even fool jndi into thinking you are in another vm when you aren't by getting an initial context using a properties object with "localhost:1099".

            So;
            invm use

            new InitialContext()

            Out of vm don't even try.

            • 3. Re: help! datasource jndi lookup!
              bjs_pd

              Hi!

              i had the same problem and found after long searching a very simple solution. Try instead of: lookup(java:/DefaultDS) only lookup(java:DefaultDS). I'll send you my ServiceLocator-Class where it was descript. It works fine!

              CU
              Bj

              • 4. Re: help! datasource jndi lookup!
                bjs_pd

                Ops, I don't want to create a Smily. I mean: lookup(java : DefaultDS). Ignore the spaces!

                CU
                BJ

                • 5. Re: help! datasource jndi lookup!
                  vickyk

                  Hi,
                  I have gone through the ServiceLocator.java and found that you are trying to get the DataSource from different
                  JVM but through the EJB,which I dont want to do.I have
                  worked on weblogic,Orion,BorlandAS,Pramati etc where I
                  am able to get the Object reference from the jndi directly,I dont include the ejb layer in between there.Any
                  way the EJB in between will cause more delay...
                  Isn't this the limitation of the Jboss....
                  Even David has specified the same,that you can't access
                  the jndi directly from the different jvm...
                  Thanks for the reply...
                  regards vickyk