0

If I do not replace the CN by default and use the default CN,It would prompt the shown logs

HttpGet httpget = new HttpGet("https://14.21.6.24:8243/1.0/test/IBM");
        logger.info("url=="+httpget.getURI());
        httpget.addHeader("content-type", "application/json");
        httpget.addHeader("Authorization"," Bearer 8bd14609-17cc-3bb7-99ed-9d8f52f8cef1");
        logger.debug("executing request " + httpget.getURI());
        // 执行get请求.
        logger.info("3");
        CloseableHttpResponse response = httpclient.execute(httpget);

javax.net.ssl.SSLException: hostname in certificate didn't match: <14.21.6.24> != <localhost>
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:231)
at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54)
Community
  • 1
  • 1
Mike
  • 419
  • 1
  • 6
  • 16

1 Answers1

1

You can use java keytool.

keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048

See this for more.

Bee
  • 12,251
  • 11
  • 46
  • 73