Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(1002) - No available client connector supports the required protocol: 'HTTPS'

I'm trying to set up a HTTPS client on Android using Restlet but I get this error:

Internal Connector Error (1002) - No available client connector supports the required protocol: 'HTTPS'. Please add the JAR of a matching connector to your classpath. Then, register this connector helper manually.

Many sources say you just need to add the jars for ssl and dependencies, so I've added the following jars:

  • org.restlet
  • org.restlet.ext.ssl
    • org.jsslutils
  • org.restlet.ext.httpclient
    • org.apache.commons.codec_1.5
    • org.apache.commons.logging_1.1
    • org.apache.httpclient_4.1
    • org.apache.httpcore_4.1
    • org.apache.httpmime_4.1
    • org.apache.james.mime4j_0.6
    • net.jcip.annotations_1.0

Restlet's docs say you need to add an external "connector" for HTTPS. According to it, the options for a HTTPS CLIENT are:

  1. Apache HTTP Client
  2. Net (which comes with the JDK)

I'm assuming I have both on (org.apache.httpclient_4.1 and JDK).

The error message mentions "register the connector helper manually" but I couldn't figure out how to do it. The docs mention parameters for the connectors. Some links there are broken, others go to javadocs with no extra text. This one lists some parameters, but all seemingly optional settings and nothing about setting an alternative connector. Some sources on the web had code snippets setting stuff by "System.setProperty". I copy-pasted some and tried with no success.

like image 749
Victor Basso Avatar asked Nov 13 '22 02:11

Victor Basso


1 Answers

This issue has been fully solved in Restlet version 2.2 where the internal HTTP/HTTPS connector is now based on HttpURLConnection, there requiring NO additional dependencies. It is lightweigth and doesn't need to use the Apache HTTP Client API. This works especially well for the Android edition.

like image 73
Jerome Louvel Avatar answered Nov 14 '22 22:11

Jerome Louvel