java.net.ConnectException: Connection refused: connect

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
Expert tip

Check if your firewall is not blocking your connection. If it's not, you might need to explicitly set advertised.host.name to advertised.host.name = yourIpAddress, this forces the hosts returned to be the resolvable IP address of your VM.

Solutions on the web

via smartfoxserver.com by Unknown author, 1 year ago
via Coderanch by Micheal John, 11 months ago
via Coderanch by Micheal John, 11 months ago
via Coderanch by Mike Thomson, 11 months ago
Connection refused: connect
via Coderanch by Micheal John, 11 months ago
java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at sun.nio.ch.SocketAdaptor.connect(Unknown Source)
at org.xsocket.stream.io.impl.IoProvider.openSocket(IoProvider.java:356)
at org.xsocket.stream.io.impl.IoProvider.createClientIoHandler(IoProvider.java:219)
at org.xsocket.stream.Connection.(Connection.java:162)
at org.xsocket.stream.NonBlockingConnection.(NonBlockingConnection.java:396)
at org.xsocket.stream.NonBlockingConnection.(NonBlockingConnection.java:209)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:134)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:301)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.dispatchConnectionError(SmartFoxClient.java:4550)
at it.gotoandplay.smartfoxclient.SmartFoxClient.handleEvent(SmartFoxClient.java:4431)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.http.HttpConnection.send(HttpConnection.java:165)
at it.gotoandplay.smartfoxclient.http.HttpConnection.connect(HttpConnection.java:68)
at it.gotoandplay.smartfoxclient.SmartFoxClient.tryBlueBoxConnection(SmartFoxClient.java:4498)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onError(SmartFoxClient.java:4471)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireErrorEvent(XMLSocket.java:206)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:140)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:301)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.dispatchConnectionError(SmartFoxClient.java:4550)
at it.gotoandplay.smartfoxclient.SmartFoxClient.handleEvent(SmartFoxClient.java:4431)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.http.HttpConnection.send(HttpConnection.java:165)
at it.gotoandplay.smartfoxclient.http.HttpConnection.connect(HttpConnection.java:68)
at it.gotoandplay.smartfoxclient.SmartFoxClient.tryBlueBoxConnection(SmartFoxClient.java:4498)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onError(SmartFoxClient.java:4471)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireErrorEvent(XMLSocket.java:206)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:140)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:301)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.dispatchConnectionError(SmartFoxClient.java:4550)
at it.gotoandplay.smartfoxclient.SmartFoxClient.handleEvent(SmartFoxClient.java:4431)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.http.HttpConnection.send(HttpConnection.java:165)
at it.gotoandplay.smartfoxclient.http.HttpConnection.connect(HttpConnection.java:68)
at it.gotoandplay.smartfoxclient.SmartFoxClient.tryBlueBoxConnection(SmartFoxClient.java:4498)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onError(SmartFoxClient.java:4471)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireErrorEvent(XMLSocket.java:206)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:140)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:301)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.dispatchConnectionError(SmartFoxClient.java:4550)
at it.gotoandplay.smartfoxclient.SmartFoxClient.handleEvent(SmartFoxClient.java:4431)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.http.HttpConnection.send(HttpConnection.java:165)
at it.gotoandplay.smartfoxclient.http.HttpConnection.connect(HttpConnection.java:68)
at it.gotoandplay.smartfoxclient.SmartFoxClient.tryBlueBoxConnection(SmartFoxClient.java:4498)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onError(SmartFoxClient.java:4471)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireErrorEvent(XMLSocket.java:206)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:140)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:301)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.dispatchConnectionError(SmartFoxClient.java:4550)
at it.gotoandplay.smartfoxclient.SmartFoxClient.handleEvent(SmartFoxClient.java:4431)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.http.HttpConnection.send(HttpConnection.java:165)
at it.gotoandplay.smartfoxclient.http.HttpConnection.connect(HttpConnection.java:68)
at it.gotoandplay.smartfoxclient.SmartFoxClient.tryBlueBoxConnection(SmartFoxClient.java:4498)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onError(SmartFoxClient.java:4471)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireErrorEvent(XMLSocket.java:206)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.connect(XMLSocket.java:140)
at it.gotoandplay.smartfoxclient.SmartFoxClient.connect(SmartFoxClient.java:1237)
at com.nhm.dlltest.SocketConnector.handleEvent(SocketConnector.java:337)
at it.gotoandplay.smartfoxclient.SFSEventDispatcher.dispatchEvent(SFSEventDispatcher.java:96)
at it.gotoandplay.smartfoxclient.SmartFoxClient.onClose(SmartFoxClient.java:4465)
at it.gotoandplay.utils.net.xmlsocket.XMLSocket.fireDisconnectEvent(XMLSocket.java:196)
at it.gotoandplay.utils.net.xmlsocket.XMLSocketClientHandler.onDisconnect(XMLSocketClientHandler.java:36)
at org.xsocket.stream.NonBlockingConnection.onDisconnectEvent(NonBlockingConnection.java:856)
at org.xsocket.stream.Connection$HandlerCallback.onDisconnect(Connection.java:1589)
at org.xsocket.stream.io.impl.IoMultithreadedHandler$IOEventHandler$3.run(IoMultithreadedHandler.java:181)
at org.xsocket.stream.io.impl.IoMultithreadedHandler$TaskQueueProcessor.processTask(IoMultithreadedHandler.java:277)
at org.xsocket.stream.io.impl.IoMultithreadedHandler$TaskQueueProcessor.run(IoMultithreadedHandler.java:265)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Users with the same issue

2 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 3 years ago
Samebug visitor profile picture
Unknown user
Once, 11 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
3 more bugmates

Know the solutions? Share your knowledge to help other developers to debug faster.