Jax-ws java.net.ConnectException: Connection refused
15,553
I have seen a similar problem when running the JAX-WS webservice on a linux box with an entry in /etc/hosts
that points the computer's hostname to localhost.
This seems to cause the JAX-WS webservice to be started on http://localhost:port/endpoint
and therefore only be accessible from that machine.
Author by
Jay Shark
Updated on June 05, 2022Comments
-
Jay Shark almost 2 years
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!
-
Jay Shark almost 13 yearsCheers for your comment. I can connect to the endpoint using the IP:Port details I'm providing from Soap UI though so i'm pretty sure they're right - the problem only occurs when connecting using the Java client that is generated from the WSDL.
-
user207421 almost 13 years@Jay Shark: is there a firewall in the path that fails? If so it isn't configured with the required ip:port open.
-
akinKaplanoglu over 8 years@EJP I have this problem also... What can i do ?
-
user207421 about 7 years@AknKplnoglu You can make sure that something is listening at the IP:port you specified. I consider this a rather trivial deduction.