I'm experiencing an odd networking problem connecting to a web service running on glassfish from a java client running on tomcat using JAX-WS (Metro). Here's the scenario...
- Both servers are running on my local machine.
- If I configure the client to connect to the WS endpoint using 127.0.0.1, the request works fine.
- If I configure the client to connect to the WS endpoint using my IP address, I immediately get java.net.ConnectException: Connection refused. The same thing happens if I use my hostname.
The odd thing is that if I hit the endpoint from SoapUI, the request works fine if use 127.0.0.1, my IP address or my hostname.
Here's the exception I'm getting...
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:529)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:120)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:256)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:184)
at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:137)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
at com.sun.xml.ws.client.Stub.process(Stub.java:323)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:161)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:113)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:144)
at $Proxy51.listAttributeTypes(Unknown Source)
at com.myapp.store.service.client.JaxWsProductAdminServiceClient.listAttributeTypes(JaxWsProductAdminServiceClient.java:71)
at com.myapp.admintool.ProductAttributeController$_closure1.doCall(ProductAttributeController.groovy:26)
at com.myapp.admintool.ProductAttributeController$_closure1.doCall(ProductAttributeController.groovy)
at java.lang.Thread.run(Thread.java:680)
Any thoughts or pointers appreciated!