How to fix the “ No subject alternative names present” error?

I fixed the problem by disabling HTTPS checks using the approach presented here:

I put following code into the the ISomeService class:

static {

private static void disableSslVerification() {
        // Create a trust manager that does not validate certificate chains
        TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
            public[] getAcceptedIssuers() {
                return null;
            public void checkClientTrusted(X509Certificate[] certs, String authType) {
            public void checkServerTrusted(X509Certificate[] certs, String authType) {

        // Install the all-trusting trust manager
        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, new;

        // Create all-trusting host name verifier
        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;

        // Install the all-trusting host verifier
    } catch (NoSuchAlgorithmException e) {
    } catch (KeyManagementException e) {

Since I’m using the https://AAA.BBB.CCC.DDD:9443/ISomeService for testing purposes only, it’s a good enough solution, but do not do this in production.

Note that you can also disable SSL for “one connection at a time” ex:

 // don't call disableSslVerification but use its internal code:
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 if (conn instanceof HttpsURLConnection) {
    HttpsURLConnection httpsConn = (HttpsURLConnection) conn;

Browse More Popular Posts

Leave a Comment