最佳答案
我有一个问题与授权 SSL 连接。我已经创建了使用客户端授权 SSL 证书连接到外部服务器的 Struts Action。在我的行动,我试图发送一些数据到银行服务器,但没有任何运气,因为我有作为一个结果,从服务器以下错误:
error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
将数据发送到服务器的 Action 类中的
//Getting external IP from host
URL whatismyip = new URL("http://automation.whatismyip.com/n09230945.asp");
BufferedReader inIP = new BufferedReader(new InputStreamReader(whatismyip.openStream()));
String IPStr = inIP.readLine(); //IP as a String
Merchant merchant;
System.out.println("amount: " + amount + ", currency: " + currency + ", clientIp: " + IPStr + ", description: " + description);
try {
merchant = new Merchant(context.getRealPath("/") + "merchant.properties");
} catch (ConfigurationException e) {
Logger.getLogger(HomeAction.class.getName()).log(Level.INFO, "message", e);
System.err.println("error: " + e.getMessage());
return ERROR;
}
String result = merchant.sendTransData(amount, currency, IPStr, description);
System.out.println("result: " + result);
return SUCCESS;
我的 merchant.properties 文件:
bank.server.url=https://-servernameandport-/
https.cipher=-cipher-
keystore.file=-key-.jks
keystore.type=JKS
keystore.password=-password-
ecomm.server.version=2.0
encoding.source=UTF-8
encoding.native=UTF-8
我第一次认为这是一个证书问题,我将它从。Pfx 到。Jks,但我有同样的错误,没有改变。