1

i just updated to restlet rc6 from previously rc5. The android app does a simple https call to an externel url.

In rc5 everything worked find, in rc6 i now get the following error:

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

can anyone tell me what has changed in rc6 so that it is not working anymore?

the release notes for rc6 say:

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

unfortunately i didn´t find any hints in the official docs what to change in my code in order to get it working again.

thanx, thilo

1 Answer 1

3

The silly bunnies included the following in the DefaultSslContextFactory.createSslContext(..) method for rc6 apparently:

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

I.e. they hardcoded SunX509 which is proprietary to the Sun JDK - a pretty bad idea overall. This was fixed in the commit 025d356d9fc3620ba9ed613fed32f1a5668f4f70, 17 days ago.

If you need it to work now you could try downloading and building the libraries yourself of course.

4
  • What is the proper way to configure this on Android then? Aug 31, 2012 at 14:41
  • The "latest" source should work, they've removed the direct reference to SunX509 at least.
    – Jens
    Aug 31, 2012 at 16:47
  • hm, i just updated to version 2.1.0 which was release on 09/20/2012. The exception is still the same: Caused by: java.security.NoSuchAlgorithmException: TrustManagerFactory SunX509 implementation not found
    – Thilo
    Sep 25, 2012 at 8:35
  • 2
    A workaround is to set the following property: System.setProperty( "ssl.TrustManagerFactory.algorithm", javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm()) This is working for me.
    – Thilo
    Sep 25, 2012 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.