2 Replies Latest reply on Jun 23, 2003 5:56 AM by viz

    Newbie: JNDI problem

    viz

      Hi All,

      I have a very simple bean deployed. I have tested it and it works from a simple client. To do a successful Context lookup(...) I needed to place the following code in my client code:

      System.setProperty( "java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
      System.setProperty( "java.naming.provider.url", "localhost:1099" );

      However, in a JSP (Tomcat 4.1.24 integrated into JBoss 3.2.1) this does not work, and I can't seem to get anything to work.

      What code do I need to place into a JSP to be able to find the JNDI name to which my bean is bound?

      All thoughts gratfully received.

      --
      Viz

        • 1. Re: Newbie: JNDI problem
          jonlee

          If you are using an embedded servlet container (jbossweb-jetty.sar or jbossweb-tomcat.sar), you only need:
          Context jndiContext = new InitialContext();
          Object reference = jndiContext.lookup("MyEJB");

          This will pickup the jndi.properties already set in the JVM (running JBoss and Tomcat).

          • 2. Re: Newbie: JNDI problem
            viz

            Hummm....

            Okay, I'll try this again.

            Many thanks for the reply.

            Kind regards,
            --
            Viz