1 Reply Latest reply on Jan 14, 2003 9:34 AM by lumin

    JBuilder7/8 & JBossOpenTool2.5 problems with Naming/Director

    mnachev Newbie

      I receive javax.naming.NameNotFoundException exception when I try to lookup my simple EJB from a simple Servlet.
      My test sample is very simple. Just one EJB and one Servlet from which I try to get some data and to show to the web.
      In the used Server configuration for JBoss with JBossOpenTool the active Services (Project Properties/Server/JBoss 3.x/Services) are:
      - Deployment
      - EJB
      - JSP/Servlet

      Unfortunately Naming/Directory service is not Active.
      Is it possible my problem is because Naming/Directory service is not Active. I try with JBuilder 7 and 8.

      In the source code of JBossOpenTool I see that there are some comments for JB7 and JB7/JB8. Part of the commented code is for Naming/Directory service.
      Do I have to removes the comments in order to use this tool with JBuilder7 and JBuilder8?

        • 1. Re: JBuilder7/8 & JBossOpenTool2.5 problems with Naming/Dire
          lumin Newbie

          Hi,

          from my point of vies your probem doesn't depend on Jbuilder or the the voyager plugin. JBoss provides an implementation JNDI. Hopefully the following code snippet helps.

          betst regards ,
          lumin

          Hashtable entries = new Hashtable();
          Vector keys = new Vector();
          try {
          Hashtable htenv = new Hashtable();
          //Look at the Jboss Quick Start Manual, to find this
          htenv.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

          InitialContext context = new InitialContext(htenv);
          NamingEnumeration ne = context.listBindings("");

          if (!ne.hasMoreElements())
          out.println("I'm sorry, but there are no elemnts available");


          while (ne.hasMoreElements()){
          Binding binding = (Binding)ne.next();
          out.println("Binding-Name: "+binding.getName()+" Object: "+binding.getObject().toString()+"");

          }