10 Replies Latest reply on Aug 24, 2009 5:16 AM by jaikiran pai

    Could not obtain connection to any of these urls: Remote-IP:

    Edwin Espinoza Newbie

      Hi all,

      I've a problem with EJB3 on JBOSS 4.2.2. I have a ejb-jar.jar in app server(remote), but I want test client with ECLIPSE(from my computer) and I try it in a main class, but I have a error.

      jndi.properties:

      java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs = org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url = jnp://Remote-IP:1099


      public static void main(String[] args) {

      /*System.setProperty("java.security.policy","client.policy");
      if(System.getSecurityManager()==null)
      System.setSecurityManager(new RMISecurityManager());

      System.setProperty("sun.net.client.defaultReadTimeout", "100000");*/
      try {


      Properties properties = new Properties();
      properties.load(new FileInputStream("jndi.properties"));

      Context contexto = null;

      contexto = new InitialContext(properties);

      GreeterFacade beanRemoto = (GreeterFacade)

      contexto.lookup(BouncerFacadeBean.RemoteJNDIName);

      Collection resultado = beanRemoto.listadoPedidos();
      for (Iterator iterator = resultado.iterator(); iterator.hasNext();) {
      String object = (String) iterator.next();
      System.out.println("El resultado es:" + resultado);
      }
      }

      catch (NamingException e)
      {
      e.printStackTrace();
      } catch (FileNotFoundException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }

      error:

      javax.naming.CommunicationException: Could not obtain connection to any of these urls: Remote-IP:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server Remote-IP:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server Remote-IP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1416)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:596)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at demoEJB.Testing.main(Testing.java:35)
      Caused by: javax.naming.CommunicationException: Failed to connect to server Remote-IP:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server Remote-IP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1387)
      ... 4 more
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server Remote-IP:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
      ... 5 more
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(Unknown Source)
      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.(Unknown Source)
      at java.net.Socket.(Unknown Source)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
      ... 5 more


      In my remote host: command line (cmd): netstat -an

      TCP 127.0.0.1:1098 0.0.0.0:0 LISTENING
      TCP 127.0.0.1:1099 0.0.0.0:0 LISTENING

      Note: Locally(server remote) works fine :)

      I hope we can help me!!

      sorry, I speak little English :)

      Thanks you!!








        • 2. Re: Could not obtain connection to any of these urls: Remote
          Edwin Espinoza Newbie

           

          "jaikiran" wrote:
          How did you start the remote server? Use -b option as explained here http://www.jboss.org/community/wiki/JBoss42FAQ


          Hi jaikiran, thanks for you replay.

          I have a installservice.bat( it create a windows service) :

          Rem Start Here
          set javadll=%JAVA_HOME%\jre\bin\client\jvm.dll
          set javatool=%JAVA_HOME%\lib\tools.jar
          set javarun=%JBOSS_HOME%\bin\run.jar
          set outlog=%JBOSS_HOME%\bin\stdout.log
          set errlog=%JBOSS_HOME%\bin\stderr.log

          JBossService.exe -install JBossTomcat "%javadll%" -Djava.class.path="%javatool%";"%javarun%" -start org.jboss.Main
          -stop org.jboss.Main -method systemExit -out "%outlog%" -err "%errlog%" -current "%JBOSS_HOME%\bin" -manual

          net start JBossTomcat

          I go to try with -b option. You notice how I was.








          • 3. Re: Could not obtain connection to any of these urls: Remote
            Edwin Espinoza Newbie

             

            "a0001428" wrote:
            "jaikiran" wrote:
            How did you start the remote server? Use -b option as explained here http://www.jboss.org/community/wiki/JBoss42FAQ


            Hi jaikiran, thanks for you replay.

            I have a installservice.bat( it create a windows service) :

            Rem Start Here
            set javadll=%JAVA_HOME%\jre\bin\client\jvm.dll
            set javatool=%JAVA_HOME%\lib\tools.jar
            set javarun=%JBOSS_HOME%\bin\run.jar
            set outlog=%JBOSS_HOME%\bin\stdout.log
            set errlog=%JBOSS_HOME%\bin\stderr.log

            JBossService.exe -install JBossTomcat "%javadll%" -Djava.class.path="%javatool%";"%javarun%" -start org.jboss.Main
            -stop org.jboss.Main -method systemExit -out "%outlog%" -err "%errlog%" -current "%JBOSS_HOME%\bin" -manual

            net start JBossTomcat

            I go to try with -b option. You notice how I was.



            Hi,
            here is the new configuratuion app server Jboss a moment the restart.

            Before:

            14:28:32,446 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
            14:28:41,384 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
            14:28:41,399 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009

            Now:

            14:25:13,137 INFO [WebService] Using RMI server codebase: http://Name-PC remote:8083/
            14:25:22,528 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-0.0.0.0-8080
            14:25:22,528 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-0.0.0.0-8009

            I'm traying...You notice how I was.



            • 4. Re: Could not obtain connection to any of these urls: Remote
              Edwin Espinoza Newbie

               

              "a0001428" wrote:
              "a0001428" wrote:
              "jaikiran" wrote:
              How did you start the remote server? Use -b option as explained here http://www.jboss.org/community/wiki/JBoss42FAQ


              Hi jaikiran, thanks for you replay.

              I have a installservice.bat( it create a windows service) :

              Rem Start Here
              set javadll=%JAVA_HOME%\jre\bin\client\jvm.dll
              set javatool=%JAVA_HOME%\lib\tools.jar
              set javarun=%JBOSS_HOME%\bin\run.jar
              set outlog=%JBOSS_HOME%\bin\stdout.log
              set errlog=%JBOSS_HOME%\bin\stderr.log

              JBossService.exe -install JBossTomcat "%javadll%" -Djava.class.path="%javatool%";"%javarun%" -start org.jboss.Main
              -stop org.jboss.Main -method systemExit -out "%outlog%" -err "%errlog%" -current "%JBOSS_HOME%\bin" -manual

              net start JBossTomcat

              I go to try with -b option. You notice how I was.



              Hi,
              here is the new configuratuion app server Jboss a moment the restart.

              Before:

              14:28:32,446 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
              14:28:41,384 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
              14:28:41,399 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009

              Now:

              14:25:13,137 INFO [WebService] Using RMI server codebase: http://Name-PC remote:8083/
              14:25:22,528 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-0.0.0.0-8080
              14:25:22,528 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-0.0.0.0-8009

              I'm traying...You notice how I was.




              Hi all,

              I restarted JBOSS with run.bat -b 0.0.0.0 (server remote windows 2003 server) :

              JBoss Bootstrap Environment
              ===============================================

              04:43:19,977 INFO [Server] Starting JBoss (MX MicroKernel)...
              04:43:19,993 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=
              200710221139)

              04:43:25,212 INFO [WebService] Using RMI server codebase: http://Remote-Server-Name:8083/

              04:43:43,915 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-0.0.0.0-8080

              ----------------------------------------------
              jmx-console: (jboss.j2ee)

              jar=ejb-jar-0.0.1-SNAPSHOT.jar,name=BixBox,service=EJB3
              module=ejb-jar-0.0.1-SNAPSHOT.jar,service=EJB3

              ----------------------
              Host file:
              127.0.0.1 localhost

              ----------------------

              IP Public> Remote-Server-Name/Ip server remote( windows 2003 server ).
              -----------------------------------------

              jndi.properties(in main client):

              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              java.naming.provider.url=jnp://IP Public:1099
              --------------------
              main client localhost( my pc ): show error:

              javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: Remote-Server-Name; nested exception is:
              java.net.UnknownHostException: Remote-Server-Name]
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:724)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
              at javax.naming.InitialContext.lookup(Unknown Source)
              at demoEJB.Testing.main(Testing.java:27)
              Caused by: java.rmi.UnknownHostException: Unknown host: Remote-Server-Name; nested exception is:
              java.net.UnknownHostException: Remote-Server-Name
              at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
              at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
              at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
              at sun.rmi.server.UnicastRef.invoke(Unknown Source)
              at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
              ... 3 more
              Caused by: java.net.UnknownHostException: Remote-Server-Name
              at java.net.PlainSocketImpl.connect(Unknown Source)
              at java.net.SocksSocketImpl.connect(Unknown Source)
              at java.net.Socket.connect(Unknown Source)
              at java.net.Socket.connect(Unknown Source)
              at java.net.Socket.(Unknown Source)
              at java.net.Socket.(Unknown Source)
              at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
              at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
              ... 9 more

              Help me please!!

              Thanks you!!











              • 5. Re: Could not obtain connection to any of these urls: Remote
                jaikiran pai Master

                 

                javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: Remote-Server-Name ; nested exception is:
                java.net.UnknownHostException: Remote-Server-Name ]


                On your client system where the demoEJB.Testing.main is running, do you have a entry in etc/hosts file to map the Remote-Server-Name to the IP address of the remote server?


                • 6. Re: Could not obtain connection to any of these urls: Remote
                  Edwin Espinoza Newbie

                  Hi,

                  Thank for you replay.

                  Let me explain better.

                  In my computer(Local) I have a client test:

                  public static void main(String[] args) {
                  try {
                  Properties properties = new Properties();
                  properties.load(new FileInputStream("jndi.properties"));

                  Context contexto = null;

                  contexto = new InitialContext(properties);

                  GreeterFacade beanRemoto = (GreeterFacade)

                  contexto.lookup(BouncerFacadeBean.RemoteJNDIName);

                  Collection resultado = beanRemoto.listadoPedidos();
                  for (Iterator iterator = resultado.iterator(); iterator.hasNext();) {
                  String object = (String) iterator.next();
                  System.out.println("El resultado es:" + resultado);
                  }
                  }



                  This is the error(is a new error):

                  javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                  java.net.UnknownHostException: obelix]
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:724)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
                  at javax.naming.InitialContext.lookup(Unknown Source)
                  at demoEJB.Testing.main(Testing.java:27)
                  Caused by: java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                  java.net.UnknownHostException: obelix
                  at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
                  at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
                  at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
                  at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                  at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                  ... 3 more
                  Caused by: java.net.UnknownHostException: obelix
                  at java.net.PlainSocketImpl.connect(Unknown Source)
                  at java.net.SocksSocketImpl.connect(Unknown Source)
                  at java.net.Socket.connect(Unknown Source)
                  at java.net.Socket.connect(Unknown Source)
                  at java.net.Socket.(Unknown Source)
                  at java.net.Socket.(Unknown Source)
                  at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
                  at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
                  ... 9 more



                  where obelix is the Sever remote name, this server has a IP Public(ISP): z.z.z.z

                  jndi.properties(for main client, local):

                  java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                  java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                  java.naming.provider.url=jnp:// z.z.z.z(IP Public):1099


                  ==Server remote( win 2003 server, office server that is in another city)=============

                  On the server remote I did:


                  I restarted JBOSS with run.bat -b 0.0.0.0 (command line)

                  JBoss Bootstrap Environment

                  04:43:19,977 INFO [Server] Starting JBoss (MX MicroKernel)...
                  04:43:19,993 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=
                  200710221139)

                  04:43:25,212 INFO [WebService] Using RMI server codebase: http:// obelix :8083/

                  04:43:43,915 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-0.0.0.0-8080

                  I put on URL:(in server remote)
                  http://localhost:8080/jmx-console: (jboss.j2ee)

                  jar=ejb-jar-0.0.1-SNAPSHOT.jar,name=BixBox,service=EJB3
                  module=ejb-jar-0.0.1-SNAPSHOT.jar,service=EJB3

                  Server remote has:
                  Host file:
                  127.0.0.1 localhost


                  I hope I've explained well :) :)

                  Help me please!!

                  Thanks you!!



                  • 7. Re: Could not obtain connection to any of these urls: Remote
                    jaikiran pai Master

                     

                    Server remote has:
                    Host file:
                    127.0.0.1 localhost


                    We are more interested in the host file of the client :)

                    What does the client host file have? It should have a mapping between the hostname obelix and the z.z.z.z public IP.


                    • 8. Re: Could not obtain connection to any of these urls: Remote
                      Edwin Espinoza Newbie

                      Hi,

                      problem is the same:

                      javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                      java.net.UnknownHostException: obelix]
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:724)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
                      at javax.naming.InitialContext.lookup(Unknown Source)
                      at demoEJB.Testing.main(Testing.java:27)
                      Caused by: java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                      java.net.UnknownHostException: obelix
                      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
                      at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
                      at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
                      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                      ... 3 more
                      Caused by: java.net.UnknownHostException: obelix
                      at java.net.PlainSocketImpl.connect(Unknown Source)
                      at java.net.SocksSocketImpl.connect(Unknown Source)
                      at java.net.Socket.connect(Unknown Source)
                      at java.net.Socket.connect(Unknown Source)
                      at java.net.Socket.(Unknown Source)
                      at java.net.Socket.(Unknown Source)
                      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
                      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
                      ... 9 more


                      Server remote modify Host file:

                      127.0.0.1 localhost
                      x.x.x.x obelix

                      I was traying:

                      obelix 77.226.178.32
                      x.x.x.x localhost

                      I was traying:

                      obelix 77.226.178.32
                      localhost x.x.x.x

                      is the same .


                      help me.










                      • 9. Re: Could not obtain connection to any of these urls: Remote
                        Edwin Espinoza Newbie

                         

                        "a0001428" wrote:
                        Hi,

                        problem is the same:

                        javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                        java.net.UnknownHostException: obelix]
                        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:724)
                        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
                        at javax.naming.InitialContext.lookup(Unknown Source)
                        at demoEJB.Testing.main(Testing.java:27)
                        Caused by: java.rmi.UnknownHostException: Unknown host: obelix; nested exception is:
                        java.net.UnknownHostException: obelix
                        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
                        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
                        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
                        at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                        ... 3 more
                        Caused by: java.net.UnknownHostException: obelix
                        at java.net.PlainSocketImpl.connect(Unknown Source)
                        at java.net.SocksSocketImpl.connect(Unknown Source)
                        at java.net.Socket.connect(Unknown Source)
                        at java.net.Socket.connect(Unknown Source)
                        at java.net.Socket.<init>(Unknown Source)
                        at java.net.Socket.<init>(Unknown Source)
                        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
                        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
                        ... 9 more


                        Server remote modify Host file:

                        127.0.0.1 localhost
                        x.x.x.x obelix

                        I was traying:

                        obelix 77.226.178.32
                        x.x.x.x localhost

                        I was traying:

                        obelix 77.226.178.32
                        localhost x.x.x.x

                        is the same .


                        help me.



                        Hi ,

                        In my host file I has mapping Now.

                        127.0.0.1 local
                        z.z.z.z obelix

                        -----------------------
                        z.z.z.z is IP public
                        but the error is the same.

                        I hope you help me!









                        • 10. Re: Could not obtain connection to any of these urls: Remote
                          jaikiran pai Master

                           

                          In my host file I has mapping Now.
                          127.0.0.1 local
                          z.z.z.z obelix

                          Where exactly is this host file located? On which system? Is it on the system where JBoss server is running or is it on the system where the client is running?

                          From the system where the client is running, try these following commands:

                          ping obelix


                          telnet obelix 1099


                          What is the output of these commands?