java SSL Servlet 实施问题:收到超过最大允许长度的记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11240885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 04:21:34  来源:igfitidea点击:

SSL Servlet Implementation Issue : received a record that exceeded the maximum permissible length

javaservletssecuritykeystore

提问by Murphy316

I am having problem using SSL with my application. I did the following:

我在我的应用程序中使用 SSL 时遇到问题。我做了以下事情:

I added the following passage to my security-contraint tag:

我在我的 security-contraint 标签中添加了以下段落:

 <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>

and added the following in my Server.xml in Tomcat

并在 Tomcat 的 Server.xml 中添加以下内容

<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="c:/keystore.key"
keystorePass="mypassword" />

Now at

现在在

https://localhost:8443/Appname/page.jsp

I get the following

我得到以下

Secure Connection Failed
An error occurred during a connection to localhost:8443.

SSL received a record that exceeded the maximum permissible length.

(Error code: ssl_error_rx_record_too_long)
  The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
  Please contact the website owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.

Any suggestions ?

有什么建议 ?

回答by Joachim Sauer

You must set SSLEnabledto trueon your connector.

您必须在连接器上设置SSLEnabledtrue

<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="c:/keystore.key"
keystorePass="mypassword"
SSLEnabled="true" />

回答by Jagadeesh

It also depends on the browser you are using. Myself had the same issue in my local environment. I have tried in Firefox and Chrome and faced this issue. But when I tried in Internet Explorer after reading couple post on the google, it worked with no issues.

这也取决于您使用的浏览器。我自己在本地环境中也遇到了同样的问题。我曾在 Firefox 和 Chrome 中尝试过,但遇到了这个问题。但是当我在 google 上阅读了几篇文章后在 Internet Explorer 中尝试时,它没有问题。

-Thanks

-谢谢