0 Replies Latest reply on Oct 11, 2001 9:36 AM by Rodrigo

    doing JNDI operations remotely

    Rodrigo Newbie

      If I run the following code in a JSP:

      Properties h = new Properties();
      String ejbUser = null;
      String ejbPassword = null;
      String ejbUrl = "jnp://the_internal_or_external_ip_of_the_host:1099";
      String initialContextFactory = "org.jnp.interfaces.NamingContextFactory";
      h.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
      h.put(Context.PROVIDER_URL, ejbUrl);
      h.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      if (ejbUser != null)
      {
      h.put(Context.SECURITY_PRINCIPAL, ejbUser);
      if (ejbPassword == null)
      ejbPassword = "";
      h.put(Context.SECURITY_CREDENTIALS, ejbPassword);
      }
      Context ctx = new InitialContext(h);
      System.out.println(ctx);
      out.println(ctx);
      try
      {
      Enumeration enum = ctx.list("wise");
      while (enum.hasMoreElements())
      {
      Object o = (Object) enum.nextElement();
      out.println(o);
      }
      }
      catch(Exception e)
      {
      e.printStackTrace(new PrintWriter(out));
      }

      It works fine if I run it in the tomcat integrated with the JBoss. But running the jsp in Orion acessing JBoss, the following shows:

      javax.naming.InitialContext@f037f8
      javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connection refused to host: <the external ip of the host>; nested exception is:
      java.net.ConnectException: Connection refused: no further information
      java.net.ConnectException: Connection refused: no further information
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:312)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
      at java.net.Socket.(Socket.java:273)
      at java.net.Socket.(Socket.java:100)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)
      at org.jnp.server.NamingServer_Stub.list(Unknown Source)
      at org.jnp.interfaces.NamingContext.list(NamingContext.java:531)
      at org.jnp.interfaces.NamingContext.list(NamingContext.java:520)
      at javax.naming.InitialContext.list(InitialContext.java:390)
      at __jspPage0_test_jsp._jspService(__jspPage0_test_jsp.java:54)
      at com.orionserver.http.OrionHttpJspPage.service(Unknown Source)
      at com.evermind._ah._rad(Unknown Source)
      at com.evermind.server.http.JSPServlet.service(Unknown Source)
      at com.evermind._cxb._abe(Unknown Source)
      at com.evermind._cxb._uec(Unknown Source)
      at com.evermind._io._twc(Unknown Source)
      at com.evermind._io._gc(Unknown Source)
      at com.evermind._if.run(Unknown Source)


      It was possible to obtain the initial context, but any operation on it causes a javax.naming.CommunicationException. The same happens if I, for example, perform a lookup for an EJB. Anyone knows why this happens? Do I have to make any setup for permission access from other hosts on the JBoss?
      Is there any problem for the host having 2 ip addresses? Even though I use the internal ip, the error message always shows the external ip.