1 Reply Latest reply on Jul 5, 2004 4:52 PM by jdaniel0309

    Problemas with JNDI

    jdaniel0309

      I'm running Jboss 3.2.4 under a RH 7.3 box.
      I've deployed a session bean.
      When I run the client code bellow, from the same box I've my Jboss Installed it runs well, but when I run it from another computer (windows) in the same network, it fails in the lookup line and Throws the following exception
      Java.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1 ….”

      I am sure the service is available when reach the 1099 port by telnet, for instance, ir replays me something like this

      ¼ÃÂ�sr↓java.rmi.MarshalledObject|¢▲ùÃÂ�c³>☻♥I♦hashlocBytest☻[BobjBytesq~☺xpù¨┴?ur☻[B
      ↨°TÓ☻xp'¼ÃÂ�t▬http://develop01:8083/q~q~uq~♥└¼ÃÂ�sr org.jnp.server.NamingServer_Stub
      ☻☻xrjava.rmi.server.RemoteStubÚ■▄╔ïße☻xr∟java.rmi.server.RemoteObjectËa┤æ
      a3▲♥xpw
      4
      UnicastRef2 127.0.0.1♦J☺╝ѱ²Å!÷♠Ç☺x

      I know I am doing something wrong, but I do not have a clue where. The Linux box are not behind a firewall.


      Properties prop = new Properties();
       prop.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       prop.put("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");
       prop.put("java.naming.provider.url", "jnp://211.3.40.48:1099");
       BandeiraEjbHome bh = null;
       try{
       Context ctx = new InitialContext(prop);
       Hashtable ht = ctx.getEnvironment();
       Iterator it = (Iterator) ht.elements();
       while (it.hasNext()){
       System.out.println("Environment--> " +it.next());
       }
       Object obj = ctx.lookup("CadBandeira");
       System.out.println("After lookup");
       bh = (BandeiraEjbHome)
       javax.rmi.PortableRemoteObject.narrow(obj, BandeiraEjbHome.class);
       }catch (NamingException e){
       ShowOnScreen sOnS = new ShowOnScreen();
       sOnS.mostrar("Erro Conectando com o Servidor"," ",e);
       e.printStackTrace();
       }


        • 1. Re: Problemas with JNDI
          jdaniel0309

          I found the problem

          In the file /etc/hosts where Jboss is installed I have only one entry point to 127.0.0.1 (lo) interface, so I add 211.3.40.48 pointing to develop01 and it start running fine. I don't know why but jboss use this file.