java.net.SocketException:Unexpected end of file from server exception resolution __.net

Source: Internet
Author: User
Tags tomcat server

The business needs of the company require a similar version of the Web application, the project is deployed in the same (but not the same configuration), when deployed to new locations, such as Tomcat server, reported the following error:

java.net.socketexception:unexpected end of file from server at Sun.net.www.http.HttpClient.parseHTTPHeader (httpclient.java:806) at Sun.net.www.http.HttpClient.parseHTTP ( httpclient.java:665) at Sun.net.www.http.HttpClient.parseHTTPHeader (httpclient.java:803) at Sun.net.www.http.HttpClient.parseHTTP (httpclient.java:665) at Sun.net.www.protocol.http.HttpURLConnection.getInputStream (httpurlconnection.java:1230) ...... at the. at Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:103) at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:293) at Org.apache.coyote.http11.Http11Processor.process (http11processor.java:861) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:606) at Org.apache.tomcat.util.net.jioendpoint$worker.run (jioendpoint.java:489) at Java.lang.Thread.run (thread.java:761) 

In order to solve the problem, for several hours, the total feeling is that the exchange of the project between the problem, because the whole project has six or seven projects, there is mutual visits between the works, to see the background log is indeed a matter of mutual visits. Initially thought it was engineering code problems, six or seven projects deployed in the same machine 3 Tomcat, project exchange of visits directly to the intranet can be. But throw the above error, all of a sudden Meng, external network access can, why the exchange between the intranet is not.

To solve this problem, re-examine the next configuration, there is no mistake, the final discovery is due to the Tomcat environment configuration problem, the previous deployment of the HTTP protocol, now deployed Tomcat is the HTTPS protocol, Tomcat in the HTTP and HTTPS protocol has a different port,

as follows, my Tomcat HTTPS port is 8083

<connector port= "8083" protocol= "Org.apache.coyote.http11.Http11Protocol" true "sslenabled="
      Scheme= "https" secure= "true"
      clientauth= "false" sslprotocol= "TLS"
      keystorefile= "/u01/ssl/server.jks" keystorepass= "Password"
      truststorefile= "/u01/ssl/server.jks" truststorepass= "password"/>

HTTP port is 8030

<connector port= "8030" protocol= "http/1.1" connectiontimeout= "20000" 
               redirectport= "8443"/>

Be sure to pay attention to this issue and then add HTTPS support to the project's Web.xml file

<security-constraint>
    <web-resource-collection>
      <web-resource-name>ssl</ web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </ User-data-constraint>
  </security-constraint>

If there is a dynamic access to the project by getting the address in the database table, using Https://ip:port this way, the connection timeout will be reported when I test.

Finally switched to the Https://localhost:port access method to successfully run the project code. Record the experience, easy to encounter the same problem of the code farmers, provide a solution or ideas.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.