从 xapi 连接到 xenserver7.2 抛出异常 security.cert

Connection to xenserver7.2 from xapi throwing exception security.cert

连接 Java XenServer API 抛出以下异常

org.apache.xmlrpc.XmlRpcException: Failed to read servers response: java.security.cert.CertificateException: No subject alternative names present
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:150)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
at com.xensource.xenapi.Connection.dispatch(Connection.java:330)
at com.xensource.xenapi.Session.loginWithPassword(Session.java:614)
at TestBase.connect(TestBase.java:68)
at TestBase.RunTest(TestBase.java:55)
at RunTests.main(RunTests.java:94)

我有 XenCenter 和 XenServer 7.2 的根访问权限,我也通过 XenCenter 连接并尝试使用 XenApi 从我通过 xencenter 连接的同一系统连接到远程 xenserver。

前路请助

我在与 xenserver 建立连接以接受所有证书时不得不使用它

HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
                    public boolean verify(String hostname, SSLSession session) {
                        return true;
                    }
                });

connection = new Connection(new URL("https://" +           target.getHostname()));

log.debug(String.format("logging in to '%s'...", target.getHostname()));
Session.loginWithPassword(connection, target.getUsername(), target.getPassword(), APIVersion.latest().toString());
log.debug("Success! Session API version is %s", connection.getAPIVersion().toString());