开发者社区> 问答> 正文

ECS服务器JAVA调用支付宝超时

java调用支付宝,本地测试OK,放在阿里云服务器上后,客户端与服务器通讯正常,但是在第一笔成功后的5-15秒(15秒估算的)内不能重复通讯,否则超时。异常如下
2017/12/17 16:04:26.660-[XQBHServer.ServerTran.AlipayQuery.exec:105]-[LOG_ERR]-com.alipay.api.AlipayApiException: java.net.SocketTimeoutException: Read timed out

    at XQBHServer.Test.MyAlipayClient.doPost(MyAlipayClient.java:362)
    at XQBHServer.Test.MyAlipayClient._execute(MyAlipayClient.java:315)
    at XQBHServer.Test.MyAlipayClient.execute(MyAlipayClient.java:96)
    at XQBHServer.Test.MyAlipayClient.execute(MyAlipayClient.java:85)
    at XQBHServer.Test.MyAlipayClient.execute(MyAlipayClient.java:81)
    at XQBHServer.ServerTran.AlipayQuery.exec(AlipayQuery.java:103)
    at XQBHServer.ServerTran.Tran.execDo(Tran.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at XQBHServer.ServerTran.CommonTran.Comtran(CommonTran.java:64)
    at XQBHServer.Server.ServerMain$1$1.run(ServerMain.java:95)
    at java.lang.Thread.run(Thread.java:748)

Caused by: java.net.SocketTimeoutException: Read timed out

    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
    at sun.security.ssl.InputRecord.read(InputRecord.java:503)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:162)
    at XQBHServer.Test.MyWebUtils.doPost(MyWebUtils.java:82)
    at XQBHServer.Test.MyWebUtils.doPost(MyWebUtils.java:60)
    at XQBHServer.Test.MyAlipayClient.doPost(MyAlipayClient.java:359)
    ... 13 more

跪求大神帮忙解决!!!

展开
收起
jakalaka 2017-12-17 18:19:33 3728 0
2 条回答
写回答
取消 提交回答
  • 你这个是什么开发工具,怎么看上去这么酷

    2019-07-17 21:49:26
    赞同 展开评论 打赏
  • 自己搭了套CentOS发现没有所述问题。通讯正常。。。难道阿里云的服务器有问题?


    现在情况是代码在本地和腾讯云上是没问题的,阿里云上主要问题在于后续的TCP握手支付宝没有返回Server Hello ,而是反回了一个ACK,而联系阿里云客服说是支付宝问题,联系支付宝说是阿里云问题,很不负责。


    最后启用腾讯云解决问题。

    2019-07-17 21:49:25
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS块储存产品全面解析 立即下载