1

am trying to use Azure notification hub, via Java. When trying to do create registration, I get a java.net.ConnectException: Connection timed out: no further information. Can someone help me understand why this issue may come? Pls let me know if you need more information. Thanks.

Am using the code found from https://github.com/Azure/azure-notificationhubs-java-backend/blob/master/NotificationHubs.

Jar file versions are as below:

httpclient - 4.3.1
httpcore - 4.3.1
httpcore-nio - 4.3.1

Error happens in SyncCallback class, method - "failed". Exception trace is as below.

java.lang.RuntimeException: java.net.ConnectException: Connection timed out: no further information
    at com.org.utils.notifications.SyncCallback.failed(SyncCallback.java:41)
    at org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:130)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.connectionRequestFailed(DefaultClientExchangeHandlerImpl.java:318)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.access$100(DefaultClientExchangeHandlerImpl.java:63)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl$1.failed(DefaultClientExchangeHandlerImpl.java:364)
    at org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:130)
    at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalPoolEntryCallback.failed(PoolingNHttpClientConnectionManager.java:474)
    at org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:130)
    at org.apache.http.nio.pool.RouteSpecificPool.failed(RouteSpecificPool.java:165)
    at org.apache.http.nio.pool.AbstractNIOConnPool.requestFailed(AbstractNIOConnPool.java:530)
    at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSessionRequestCallback.failed(AbstractNIOConnPool.java:778)
    at org.apache.http.impl.nio.reactor.SessionRequestImpl.failed(SessionRequestImpl.java:154)
    at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:175)
    at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:147)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:349)
    at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:189)
    at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.doExecute(CloseableHttpAsyncClientBase.java:67)
    at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.access$000(CloseableHttpAsyncClientBase.java:38)
    at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:57)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
    at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:173)
    ... 7 more
csharpnewbie
  • 789
  • 2
  • 12
  • 33
  • 1
    Could you check in the debugger where it's trying to connect to and make sure you can make the call through the command line or any other way? It might be a closed port or firewall blocking the call. – Nikita R. Jul 25 '17 at 16:41

1 Answers1

1

you can find the some resone of this java.net.ConnectException: Connection timed out Exception.

  1. firewall of your system port rang which you are using into your project. check your filewale setting and unblock the port.

  2. IP/domain or port is incorrect. try to ping or telnet command to check connectivity.

  3. may be due to slow internet or havy process server are not processes the request in time period, or may b connection issue.

Mayank Sharma
  • 403
  • 2
  • 2
  • @nikita-g/Mayank - As I had mentioned it is trying to connect to Azure notification hub to create device registration. I checked the url via postman, and it works fine. Am trying to run the code on Eclipse + Tomcat server combination. – csharpnewbie Jul 25 '17 at 17:35
  • @csharpnewbie Is there a proxy server in your network environment? Chrome/Postman will use the local default proxy server setting to connect network, but Java not unless via method `System.setProperty` to set. – Peter Pan Jul 26 '17 at 06:18