我在android 2.3.3上使用restlet 2.2并且我需要与服务器建立https连接,但是这个服务器没有证书,因为我得到以下错误:
06-05 19:11:13.786: W/System.err(2923): Communication Error (1001) - Error while processing a connection
06-05 19:11:13.786: W/System.err(2923): at org.restlet.resource.ClientResource.doError(ClientResource.java:611)
06-05 19:11:13.796: W/System.err(2923): at org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:269)
06-05 19:11:13.796: W/System.err(2923): at $Proxy5.retrieve(Native Method)
06-05 19:11:13.796: W/System.err(2923): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-05 19:11:13.796: W/System.err(2923): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-05 19:11:13.796: W/System.err(2923): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-05 19:11:13.796: W/System.err(2923): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-05 19:11:13.796: W/System.err(2923): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-05 19:11:13.796: W/System.err(2923): at java.lang.Thread.run(Thread.java:1019)
06-05 19:11:13.796: W/System.err(2923): Caused by: javax.net.ssl.SSLException: Error occured in delegated task:javax.net.ssl.SSLException: Not trusted server certificate
06-05 19:11:13.806: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.HandshakeProtocol.fatalAlert(HandshakeProtocol.java:319)
06-05 19:11:13.806: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.HandshakeProtocol.wrap(HandshakeProtocol.java:271)
06-05 19:11:13.806: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.SSLEngineImpl.wrap(SSLEngineImpl.java:695)
06-05 19:11:13.806: W/System.err(2923): at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:464)
06-05 19:11:13.806: W/System.err(2923): at org.restlet.ext.ssl.internal.WritableSslChannel.onFill(WritableSslChannel.java:113)
06-05 19:11:13.806: W/System.err(2923): at org.restlet.engine.io.Buffer.process(Buffer.java:597)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.io.WritableBufferedChannel.write(WritableBufferedChannel.java:122)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.ext.ssl.internal.WritableSslChannel.write(WritableSslChannel.java:126)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.io.Buffer.drain(Buffer.java:337)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.OutboundWay.onDrain(OutboundWay.java:304)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.io.Buffer.process(Buffer.java:553)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.Way.processIoBuffer(Way.java:477)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.OutboundWay.processIoBuffer(OutboundWay.java:412)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.Way.onSelected(Way.java:430)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:295)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.Connection.onSelected(Connection.java:607)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.util.SelectionRegistration.onSelected(SelectionRegistration.java:295)
06-05 19:11:13.816: W/System.err(2923): at org.restlet.engine.connector.ConnectionController.onSelected(ConnectionController.java:202)
06-05 19:11:13.826: W/System.err(2923): at org.restlet.engine.connector.ConnectionController.selectKeys(ConnectionController.java:275)
06-05 19:11:13.826: W/System.err(2923): at org.restlet.engine.connector.ConnectionController.doRun(ConnectionController.java:155)
06-05 19:11:13.826: W/System.err(2923): at org.restlet.engine.connector.Controller.run(Controller.java:158)
06-05 19:11:13.826: W/System.err(2923): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
06-05 19:11:13.826: W/System.err(2923): ... 5 more
06-05 19:11:13.826: W/System.err(2923): Caused by: org.apache.harmony.xnet.provider.jsse.AlertException: javax.net.ssl.SSLException: Not trusted server certificate
06-05 19:11:13.826: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.HandshakeProtocol.fatalAlert(HandshakeProtocol.java:319)
06-05 19:11:13.826: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.ClientHandshakeImpl.verifyServerCert(ClientHandshakeImpl.java:600)
06-05 19:11:13.846: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.ClientHandshakeImpl.processServerHelloDone(ClientHandshakeImpl.java:392)
06-05 19:11:13.846: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.ClientHandshakeImpl$1.run(ClientHandshakeImpl.java:299)
06-05 19:11:13.846: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.ClientHandshakeImpl$1.run(ClientHandshakeImpl.java:297)
06-05 19:11:13.846: W/System.err(2923): at java.security.AccessController.doPrivileged(AccessController.java:182)
06-05 19:11:13.846: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.DelegatedTask.run(DelegatedTask.java:52)
06-05 19:11:13.846: W/System.err(2923): at org.restlet.ext.ssl.internal.SslConnection$1.run(SslConnection.java:389)
06-05 19:11:13.846: W/System.err(2923): ... 3 more
06-05 19:11:13.856: W/System.err(2923): Caused by: javax.net.ssl.SSLException: Not trusted server certificate
06-05 19:11:13.856: W/System.err(2923): ... 11 more
06-05 19:11:13.856: W/System.err(2923): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
06-05 19:11:13.856: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:161)
06-05 19:11:13.866: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.ClientHandshakeImpl.verifyServerCert(ClientHandshakeImpl.java:597)
06-05 19:11:13.866: W/System.err(2923): ... 9 more
06-05 19:11:13.866: W/System.err(2923): Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
06-05 19:11:13.866: W/System.err(2923): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:146)
06-05 19:11:13.866: W/System.err(2923): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:197)
06-05 19:11:13.876: W/System.err(2923): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:156)
06-05 19:11:13.876: W/System.err(2923): ... 10 more