10 Replies Latest reply on Jan 23, 2005 8:12 PM by Tom Elrod

    using localhost/127.0.0.1

    mazz Master

      I noticed that when I am not connected to a network (my physical network cable is not plugged in for example), and I configure everything to use either localhost or 127.0.0.1, I cannot run - the JBoss/Remoting Connector throws a socket error (cannot bind to address type exceptions). But yet, I can ping 127.0.0.1 from the command line (so I know my loopback is working).

      I know I hit this problem a couple of weeks ago (and I may have even read about this somewhere, but can't remember where)... but I searched the forums and I haven't found a specific reason or cause for this. Can someone shed some light on that? I assume I just don't have something configured properly.

        • 1. Re: using localhost/127.0.0.1
          Tom Elrod Master

          Hmm. Don't know about this. Just tried running the remoting samples without network and worked fine.

          The only things I know about that might be related are some issues with networking that sometimes come up when doing clustering. One is making sure your local firewall is turned off (if you have one). The other is windows removing your ip from routing tables when network is unplugged. To fix this can do the following:

          Launch regedit
          Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
          Services\Tcpip\Parameters
          Add a REG_DWORD key called DisableDHCPMediaSense
          Set its value to 1
          Restart Windows

          You must have a static IP address (No DHCP)


          Other than that, don't know what to offer as an explanation. Think you can help me reproduce? You running on windows xp?

          • 2. Re: using localhost/127.0.0.1
            mazz Master

            I am using WindowsXP SP2, and I do have DHCP enabled (no static IP). I have not enabled Windows firewall. I am running inside my wireless router/hub (that's my DHCP server). I can give myself a static IP on my local network here inside my router and try that registry entry and see what happens.

            • 3. Re: using localhost/127.0.0.1
              Tom Elrod Master

              I am also on XP SP2 with DHCP and no firewall. I am connected to wireless network (no physical connection). The org.jboss.samples.simple.SimpleServer runs file with or without the wireless connection disabled. Any thing else I can try to reproduce?

              • 4. Re: using localhost/127.0.0.1
                mazz Master

                Well, now of course it is working for me. I swear it just happened to me a couple of days ago (I posted to the forum soon after it happened to me while in my hotel room).

                I have been adding things to my jboss-service.xml - so this was caused either because my previous config or, the most likely cause of the problem, is that I'm an idiot and was probably doing something stupid that caused the error :-)

                In any event, if it happens to me again, I'll capture all error logs and try to get replication procedures.

                • 5. Re: using localhost/127.0.0.1
                  mazz Master

                  OK, I'm seeing it again. Very strange - I *am* connected to the network. I can successfully connect anywhere on the internet as well as ping my own machine on both 192.168.0.5 and 127.0.0.1.

                  So, my connector locator URL is socket://192.168.0.5:8084. JBoss with my .sar (which includes all my remoting stuff and the remoting jar) deploys and starts fine. I submit my first request - this one to 192.168.0.5 and I get a successful response. HOWEVER, I get the following exception in server.log:

                  2005-01-14 23:52:59,605 DEBUG [org.jboss.remoting.transport.socket.ServerThread] beginning dorun
                  
                  2005-01-14 23:52:59,655 DEBUG [org.jboss.remoting.transport.socket.SocketServerInvoker] server received invocation =>org.jboss.remoting.InvocationRequest@1c7865b
                  
                  2005-01-14 23:52:59,735 DEBUG [org.jboss.remoting.transport.socket.ServerThread] IOException when reading in ACK
                  
                  java.net.SocketException: Connection reset
                   at java.net.SocketInputStream.read(SocketInputStream.java:168)
                   at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                   at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                   at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
                   at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
                   at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
                   at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
                   at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
                   at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
                   at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:194)
                   at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:320)
                   at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)
                  
                  2005-01-14 23:52:59,735 DEBUG [org.jboss.remoting.transport.socket.ServerThread] failed
                  
                  java.net.SocketException: Connection reset
                   at java.net.SocketInputStream.read(SocketInputStream.java:168)
                   at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                   at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                   at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
                   at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
                   at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
                   at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
                   at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
                   at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
                   at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:194)
                   at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:320)
                   at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)
                  
                  2005-01-14 23:52:59,735 DEBUG [org.jboss.remoting.transport.socket.ServerThread] begin thread wait
                  


                  I then issue an identical command, only this time to 127.0.0.1. I do *not* see any exceptions appear in server.log (in fact, no messages come out in server.log), however, the response fails to return. On the client side I get this exception:

                  java.lang.Exception: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection.
                   at org.jboss.network.command.client.AbstractCommandClient.invoke(AbstractCommandClient.java:212)
                   at org.jboss.network.command.client.AbstractCommandClient.invoke(AbstractCommandClient.java:194)
                   at org.jboss.network.command.client.CmdlineClient.issueCommand(CmdlineClient.java:159)
                   at org.jboss.network.command.client.CmdlineClient.main(CmdlineClient.java:67)
                  Caused by: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection.
                   at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:203)
                   at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:96)
                   at org.jboss.remoting.Client.invoke(Client.java:197)
                   at org.jboss.network.command.client.AbstractCommandClient.invoke(AbstractCommandClient.java:208)
                   ... 3 more
                  Caused by: java.net.ConnectException: Connection refused: connect
                   at java.net.PlainSocketImpl.socketConnect(Native Method)
                   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
                   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
                   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
                   at java.net.Socket.connect(Socket.java:452)
                   at java.net.Socket.connect(Socket.java:402)
                   at java.net.Socket.<init>(Socket.java:309)
                   at java.net.Socket.<init>(Socket.java:124)
                   at org.jboss.remoting.transport.socket.SocketClientInvoker.getConnection(SocketClientInvoker.java:421)
                   at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:199)
                   ... 6 more
                  


                  I then reissue that request to 192.168.0.5 and, it works! I get a successful response back! However, looking in server.log, I again get another exception:

                  2005-01-14 23:55:04,465 DEBUG [org.jboss.remoting.transport.socket.ServerThread] WAKEUP in SERVER THREAD
                  
                  2005-01-14 23:55:04,465 DEBUG [org.jboss.remoting.transport.socket.ServerThread] beginning dorun
                  
                  2005-01-14 23:55:04,495 DEBUG [org.jboss.remoting.transport.socket.SocketServerInvoker] server received invocation =>org.jboss.remoting.InvocationRequest@cbd8dc
                  
                  2005-01-14 23:55:04,525 DEBUG [org.jboss.remoting.transport.socket.ServerThread] IOException when reading in ACK
                  
                  java.net.SocketException: Connection reset
                   at java.net.SocketInputStream.read(SocketInputStream.java:168)
                   at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                   at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                   at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
                   at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
                   at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
                   at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
                   at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
                   at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
                   at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:194)
                   at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:320)
                   at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)
                  2005-01-14 23:55:04,525 DEBUG [org.jboss.remoting.transport.socket.ServerThread] failed
                  
                  java.net.SocketException: Connection reset
                   at java.net.SocketInputStream.read(SocketInputStream.java:168)
                   at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
                   at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
                   at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2133)
                   at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2313)
                   at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2380)
                   at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2452)
                   at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2601)
                   at java.io.ObjectInputStream.readByte(ObjectInputStream.java:845)
                   at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:194)
                   at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:320)
                   at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)
                  
                  2005-01-14 23:55:04,525 DEBUG [org.jboss.remoting.transport.socket.ServerThread] begin thread wait
                  


                  127.0.0.1 consistently fails right now (I can submit 1, 2, 3 requests in a row - they all fail). 192.168.0.5 consistently succeed. I can submit any number in a row and they all fail.

                  This is using my own .sar with remoting - this is not using the SimpleServer. If you want, I can give you my .sar (all I did was take the minimal deployment and dump my sar in /deploy and test). I'm wondering if its because I'm running inside of JBoss as opposed to standalone. I'll see if SimpleServer does it too.

                  • 6. Re: using localhost/127.0.0.1
                    mazz Master

                    Tried building everything under jboss-head so I can test under the latest-n-greatest, but getting this exception:

                    Caused by: java.lang.NoSuchMethodError: org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(Ljava/lang/Object;Ljava/util/Properties;Z)V
                     at org.jboss.remoting.transport.socket.SocketServerInvoker.setup(SocketServerInvoker.java:122)
                     at org.jboss.remoting.transport.socket.SocketServerInvoker.<init>(SocketServerInvoker.java:99)
                     ... 97 more
                    


                    I'll keep playing with this - I think this means I need to put the new HEAD build of jboss-commons up in my jboss/lib directory, not in the .sar. But of course this would mean I can't backport my stuff to an earlier JBoss.... I'll confirm if this is true. In any event, the point is, I'm going to try to see if this problem goes away in HEAD.

                    • 7. Re: using localhost/127.0.0.1
                      mazz Master

                      This problem is still there in HEAD. I did have to put a new copy of jboss-common.jar (built from HEAD) in my <JBOSS_HOME>/lib directory to get this to run. But, the issue with using my IP vs. 127.0.0.1 is still there - one works, the other doesn't.

                      • 8. Re: using localhost/127.0.0.1
                        mazz Master

                        Just ran simple client/simple server test and they run fine. As another test, I ran the simple server and used my own client to connect to it on 192.168.0.5. My client actually connected to the simple server! I got an exception, but that's only because of a marshalling error (my client passes complex data over - the simple server just didn't know how to handle it - but the point is, the remoting stuff did connect from client to server; this is what failed when i ran JBoss/Remoting inside a JBoss instance).

                        I don't know what this all means. All I can tell you right now is what I see.

                        • 9. Re: using localhost/127.0.0.1
                          mazz Master

                          Just ran a final test to illustrate something else. In my jboss-service.xml, if I specify 127.0.0.1, then my client can successfully connect to 127.0.0.1 but it CANNOT connect to 192.168.0.5. And vice-versa - if my jboss-service.xml has 192.168.0.5, then my client can successfully connect on 192.168.0.5 but it CANNOT connect to 127.0.0.1. So, it looks like whatever IP is in my configuration file is the IP that I can connect to.

                          I have no idea why 127.0.0.1 would behave like this - I'm not the most network savvy person :-) Maybe its supposed to work like this, I dunno. I was always under the impression that 127.0.0.1 is a loopback address that should always connect you to the local machine.