与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的root访问权限,我也通过XenCenter连接,并尝试使用XenApi从我通过xencenter连接的同一系统连接到远程xenserver。
请帮助前进。
答案 0 :(得分:0)
当我与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());