我们正在思科DevNet网站上尝试示例应用程序,该网站演示了如何创建Extension Mobility Web服务使用者客户端。我们已按照说明将证书导入密钥库,但仍无效。
以下是样本的链接: https://developer.cisco.com/site/extension-mobility/learn/sample-apps/index.gsp
以下是错误消息:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
当我使用不安全的连接进行测试时,请使用URL作为
http:/<x.x.x.x>/:8080/emservice/EMServiceServlet
它显示500条错误消息:
java.lang.NullPointerException
java.lang.String.<init>(String.java:147)
com.cisco.emservice.EMServiceServlet.processRequest(EMServiceServlet.java:204)
com.cisco.emservice.EMServiceServlet.doPost(EMServiceServlet.java:451)
com.cisco.emservice.EMServiceServlet.doGet(EMServiceServlet.java:385)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:271)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)
这是我的代码:
public class Workplace {
public static void main(String[] args) throws Exception {
URL url = new URL("https://192.168.10.11:8443/emservice/EMServiceServlet");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
String EMRequest = "<request><appinfo><appid>operator</appid><appcertificate>operator</appcertificate></appinfo>";
EMRequest += "<login><devicename>SEP000000000001</devicename><userid>user01</userid><deviceprofile>EM-USER01/deviceprofile>";
EMRequest += "<exclusiveduration><time>60</time></exclusiveduration></login></request>";
//URL encode/escape the request
EMRequest = URLEncoder.encode(EMRequest,"UTF-8");
//Build the complete HTTP form request body
EMRequest = "xml="+EMRequest;
//Create an OutputStreamWriter for the URLConnection object and make the request
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
writer.write(EMRequest);
writer.flush();
//Read the response
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//Output the response to the console
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
//Cleanup the stream objects
writer.close();
reader.close();
}
}
这个问题有什么解决方案吗?谢谢......