无法 post 推特状态更新错误 "no trusted certificate found"

Unable to post twitter status updates with error "no trusted certificate found"

我有一个 java 进程正在使用 Twitter4J post 更新 Twitter。我有所有合适的令牌和密钥。当我尝试 post 更新时,出现此错误。我看到 Twitter 去年更新了它的证书,并且我已将 Verisign 的 Class 3 G5 证书添加到我的 cacerts 文件中。但这似乎不起作用。广泛的网络拖网尚未找到将正确的证书添加到 Twitter 的 cacerts 文件的确定程序 api。

16/02/2015 11:53:13 PM :  com.ibm.jsse2.util.g: No trusted certificate found Relevant discussions can be found on the Internet at:  http://www.google.co.jp/search?q=2fc5b7cb or  http://www.google.co.jp/search?q=11613e17 Twitter
Exception{exceptionCode=[2fc5b7cb-11613e17 2fc5b7cb-11613ded 2fc5b7cb-11613ded], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=4.0.1}
16/02/2015 11:53:13 PM :   at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:179)
16/02/2015 11:53:13 PM :   at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
16/02/2015 11:53:13 PM :   at twitter4j.HttpClientBase.post(HttpClientBase.java:82)
16/02/2015 11:53:13 PM :   at twitter4j.TwitterImpl.post(TwitterImpl.java:2004)
16/02/2015 11:53:13 PM :   at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:251)
16/02/2015 11:53:13 PM :  Caused by: 
16/02/2015 11:53:13 PM :  javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.g: No trusted certificate found
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.n.a(n.java:36)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.sc.a(sc.java:442)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gb.a(gb.java:18)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gb.a(gb.java:205)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.hb.a(hb.java:46)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.hb.a(hb.java:57)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gb.n(gb.java:285)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gb.a(gb.java:146)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.sc.a(sc.java:88)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.sc.g(sc.java:437)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.sc.a(sc.java:544)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.sc.startHandshake(sc.java:124)
16/02/2015 11:53:13 PM :   at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:48)
16/02/2015 11:53:13 PM :   at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:39)
16/02/2015 11:53:13 PM :   at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:899)
16/02/2015 11:53:13 PM :   at com.ibm.net.ssl.www2.protocol.https.b.getOutputStream(b.java:47)
16/02/2015 11:53:13 PM :   at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:137)
16/02/2015 11:53:13 PM :   ... 8 more
16/02/2015 11:53:13 PM :  Caused by: 
16/02/2015 11:53:13 PM :  com.ibm.jsse2.util.g: No trusted certificate found
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.util.f.a(f.java:154)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.util.f.b(f.java:135)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.util.d.a(d.java:12)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gc.a(gc.java:28)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gc.checkServerTrusted(gc.java:16)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.gc.b(gc.java:82)
16/02/2015 11:53:13 PM :   at com.ibm.jsse2.hb.a(hb.java:308)
16/02/2015 11:53:13 PM :   ... 20 more

我设法解决了。有2个证书文件。 cacerts 和 jssecacerts 以及 JVM 使用哪个文件来查找证书取决于系统 属性 设置和任一文件的存在。我有正确的证书,但当它应该在 jssecacerts 文件中时,却将其放入 cacerts 文件中。有关 trustmanager 及其如何与证书一起使用的更多信息,请参见 here