org.apache.commons.fileupload.FileUpload: Socket Closed using Tomcat

Viewed 27

Whilst uploading a file using the org.apache.commons.fileupload.FileUpload library I am getting this error:

org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. java.io.IOException: The socket [140,714,671,715,264] associated with this connection has been closed.
        at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
        at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
        at org.talend.administrator.common.servlet.ServletUtil.getFileItem(ServletUtil.java:50)
        at org.talend.administrator.common.servlet.ServletUtil.getFileItem(ServletUtil.java:43)
        at org.talend.gwtadministrator.server.remoterepositorymgt.services.AssociatePreGeneratedJobServlet.doPost(AssociatePreGeneratedJobServlet.java:53)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)

The error happens almost immediately after the upload starts.

How can I fix this?

1 Answers

In order to fix this problem you will need probably to turn off Http 2 on your connector. we have edited the server.xml file and turned off Http 2 for the SSL connector.

Here is the relevant configuration that was changed:

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- Begin modification by SB Onepoint Consulting Ltd to enable SSL -->
    <!-- Gil: Changed upload timeout -->
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" connectionTimeout="6000000" connectionUploadTimeout="36000000" disableUploadTimeout="false" overheadDataThreadhold="0">
        <!-- UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" / -->
        <SSLHostConfig>
            <Certificate certificateKeyFile="/opt/ssl/some.key"
                         certificateFile="/opt/ssl/some.crt"
                         certificateChainFile="/opt/ssl/IntermediateCA.crt"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

The line which needed to be commented out was:

<!-- UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" / -->

Related