2012-08-30 138 views
1

我剛剛從之前的rc5更新到restlet rc6。 Android應用程序對外部網址進行簡單的https調用。java.security.NoSuchAlgorithmException:TrustManagerFactory未找到SunX509實現

在RC5一切工作發現,在RC6我現在得到以下錯誤:

08-30 10:03:39.185: WARN/System.err(15077): Error while handling an HTTP client call 
08-30 10:03:39.185: WARN/System.err(15077): [ 08-30 10:03:39.185 15077:0x3aff W/System.err ] 
     java.lang.RuntimeException: Unable to create SSLContext. 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.ext.net.internal.HttpUrlConnectionCall.<init>(HttpUrlConnectionCall.java:130) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.ext.net.HttpClientHelper.create(HttpClientHelper.java:156) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.engine.adapter.ClientAdapter.toSpecific(ClientAdapter.java:160) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.engine.adapter.HttpClientHelper.handle(HttpClientHelper.java:111) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.Client.handle(Client.java:180) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.routing.Filter.doHandle(Filter.java:159) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.routing.Filter.handle(Filter.java:206) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.handle(ClientResource.java:1137) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.handleOutbound(ClientResource.java:1226) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.handle(ClientResource.java:1069) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.handle(ClientResource.java:1045) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.handle(ClientResource.java:951) 
08-30 10:03:39.185: WARN/System.err(15077): at org.restlet.resource.ClientResource.get(ClientResource.java:658) 
08-30 10:03:39.185: WARN/System.err(15077): at de.ewe.tk.apps.android.css.services.DocstoreService.getDocumentInfos(DocstoreService.java:86) 
08-30 10:03:39.195: WARN/System.err(15077): at de.ewe.tk.apps.android.css.activity.DocstoreListActivity$GetDocumentInfosTask.doInBackground(DocstoreListActivity.java:66) 
08-30 10:03:39.195: WARN/System.err(15077): at de.ewe.tk.apps.android.css.activity.DocstoreListActivity$GetDocumentInfosTask.doInBackground(DocstoreListActivity.java:46) 
08-30 10:03:39.195: WARN/System.err(15077): at android.os.AsyncTask$2.call(AsyncTask.java:185) 
08-30 10:03:39.195: WARN/System.err(15077): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 
08-30 10:03:39.195: WARN/System.err(15077): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 
08-30 10:03:39.195: WARN/System.err(15077): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) 
08-30 10:03:39.195: WARN/System.err(15077): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) 
08-30 10:03:39.195: WARN/System.err(15077): at java.lang.Thread.run(Thread.java:1102) 
08-30 10:03:39.195: WARN/System.err(15077): Caused by: java.security.NoSuchAlgorithmException: TrustManagerFactory SunX509 implementation not found 
08-30 10:03:39.195: WARN/System.err(15077): at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:105) 
08-30 10:03:39.195: WARN/System.err(15077): at javax.net.ssl.TrustManagerFactory.getInstance(TrustManagerFactory.java:80) 
08-30 10:03:39.195: WARN/System.err(15077): at org.restlet.ext.ssl.DefaultSslContextFactory.createSslContext(DefaultSslContextFactory.java:357) 
08-30 10:03:39.195: WARN/System.err(15077): at org.restlet.ext.net.internal.HttpUrlConnectionCall.<init>(HttpUrlConnectionCall.java:126) 
08-30 10:03:39.195: WARN/System.err(15077): ... 21 more 

誰能告訴我什麼RC6已更改,因此它不工作了?

爲RC6的發行說明說:

The support for HTTPS has been significantly completed and fixed in all connectors for : 

cipher suites restriction 
SSL/TLS protocol version restriction 
client certificate request & requirement setting 

不幸的是我didn't發現在官方的文檔的任何暗示什麼,在我的代碼,以得到它的工作改變。

感謝名單, 蒂洛

回答

3

傻兔子包括在DefaultSslContextFactory.createSslContext(..)方法RC6顯然以下:

setKeyManagerAlgorithm(helperParameters.getFirstValue(
      "keyManagerAlgorithm", true, System.getProperty(
        "ssl.KeyManagerFactory.algorithm", "SunX509"))); 

即他們對Sun JDK專有的SunX509進行了硬編碼 - 這是一個非常糟糕的主意。這在17天前的提交025d356d9fc3620ba9ed613fed32f1a5668f4f70中得到修復。

如果你需要它工作現在你可以嘗試下載和自己建立圖書館當然。

+0

那麼在Android上配置它的正確方法是什麼? –

+0

「最新」源代碼應該可以工作,至少已經刪除了對SunX509的直接引用。 – Jens

+0

hm,我剛剛更新至版本2.1.0,該版本於2012年9月20日發佈。異常仍然是: 引起:java.security.NoSuchAlgorithmException:TrustManagerFactory未找到SunX509實現 – Thilo

相關問題