1

我正在尝试通过 Java 使用 Azure 通知中心。尝试创建注册时,我得到一个 java.net.ConnectException: Connection timed out: no further information。有人可以帮我理解为什么会出现这个问题吗?如果您需要更多信息,请告诉我。谢谢。

我正在使用从https://github.com/Azure/azure-notificationhubs-java-backend/blob/master/NotificationHubs找到的代码。

jar 文件版本如下:

httpclient - 4.3.1
httpcore - 4.3.1
httpcore-nio - 4.3.1

SyncCallback 类中发生错误,方法 - “失败”。异常跟踪如下。

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
4

1 回答 1

1

你可以找到这个java.net.ConnectException: Connection timed out异常的一些原因。

  1. 您在项目中使用的系统端口的防火墙响了。检查您的 filewale 设置并取消阻止端口。

  2. IP/域或端口不正确。尝试pingtelnet命令检查连接。

  3. 可能是由于互联网速度慢或进程服务器未在一段时间内处理请求,或者可能是连接问题。

于 2017-07-25T16:51:55.013 回答