测试环境:
机器:client,server,在同一局域网,client 通过证书能访问server
client 代码:
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.setProperty("javax.net.ssl.keyStoreType","jks");
System.setProperty("javax.net.ssl.keyStore",
"/home/test/test.keystore");
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
javax.net.ssl.HostnameVerifier hv = new javax.net.ssl.HostnameVerifier(){
public boolean verify(String urlHostName,javax.net.ssl.SSLSession session){
System.out.println("Warning:URL Host: "+urlHostName+" vs. "+session.getPeerHost());
return true;
}
};
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(hv);
HessianProxyFactory factory = new HessianProxyFactory();
String url1 = "https://172.16.2.222:8443/test/testHessian";
testHessianInterface d1 = (testHessianInterface) factory.create(testHessianInterface.class,url1);
System.out.println("call remote service 01: "+d1.hello(" test "));
运行会报出错信息:
com.caucho.hessian.io.HessianProtocolException:
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java)
at $Proxy0.hello(Unknown Source)
我另外做过一个实验,当client 和server 在同一台机器上
程序运行正确。
不知道是什么问题,请高手指教。
--
FROM 211.100.255.*