2 mingyanhuang mingyanhuang 于 2013.08.02 13:53 提问

调用OAuth4Code 出现weibo4j.model.WeiboException: Connection reset错误

执行OAuth4Code 跳转到配置文件中定义的redirect_URI , 从浏览器中拷贝code在控制台中黏贴,回车,代码继续执行到 oauth.getAccessTokenByCode(code); 报下列异常
Hit enter when it's done.[Enter]:633579c984915e30f8127d9b833b4b56
1 INFO [2013-08-02 11:12:06] code: 633579c984915e30f8127d9b833b4b56
6 DEBUG [2013-08-02 11:12:06] Request:
6 DEBUG [2013-08-02 11:12:06] POSThttps://api.weibo.com/oauth2/access_token
346 INFO [2013-08-02 11:12:07] I/O exception (java.net.SocketException) caught when processing request: Connection reset
346 INFO [2013-08-02 11:12:07] Retrying request
364 INFO [2013-08-02 11:12:07] I/O exception (java.net.SocketException) caught when processing request: Connection reset
364 INFO [2013-08-02 11:12:07] Retrying request
382 INFO [2013-08-02 11:12:07] I/O exception (java.net.SocketException) caught when processing request: Connection reset
382 INFO [2013-08-02 11:12:07] Retrying request
weibo4j.model.WeiboException: Connection reset
at weibo4j.http.HttpClient.httpRequest(HttpClient.java:422)
at weibo4j.http.HttpClient.post(HttpClient.java:302)
at weibo4j.Oauth.getAccessTokenByCode(Oauth.java:80)
at weibo4j.examples.oauth2.OAuth4Code.main(OAuth4Code.java:22)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:632)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at weibo4j.http.HttpClient.httpRequest(HttpClient.java:396)
... 3 more

Csdn user default icon
上传中...
上传图片
插入图片