gpt4 book ai didi

java - AXIS java 应用程序中的 SSLException : Unrecognized SSL message, 明文连接错误

转载 作者:太空宇宙 更新时间:2023-11-03 15:06:55 26 4
gpt4 key购买 nike

我有一个使用 Axis 从 Web 服务获取数据的 Java 应用程序。 Web 服务通过 HTTPS 访问。它在我的本地 PC 上运行良好,但客户使用代理。我添加了代理设置:

System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", host);
System.getProperties().put( "proxyPort", port);
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username,
password.toCharArray());
}
});

但客户得到异常(exception):

faultDetail: 
{http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
...

有人可以帮忙吗?

最佳答案

 System.getProperties().put( "proxySet", "true" );

那什么都不做。消除。 JDK中没有这样的属性。

 System.getProperties().put( "proxyHost", host);
System.getProperties().put( "proxyPort", port);

如果您使用的是 SSL,它们应该分别是 https.proxyHost/https.proxyPort。对于明文连接,http.proxyHost/http.proxyPort。

关于java - AXIS java 应用程序中的 SSLException : Unrecognized SSL message, 明文连接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5672850/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com