Unexpected server response (0) while retrieving pdf

6k Views Asked by At

We are specifically getting this error when using Amazon ec2 instance. Configuration on aws instance is Tomcat 7, Ubuntu 16.04 and memory is 8gb. It occurs when the user tries to view pdf file. In our application, we are having one functionality where the user can only view PDF file onto browser, but won't be able to download it. PDF file is on the same server. We are using cors minimal configuration. We have tried it locally with Ubuntu and it is working fine.

enter image description here

Code snippet:

var fileSplitContent = fileName.split(".");
    if ($('#viewImageOnlyForm')[0] != undefined && $('#viewPdfOnlyForm')[0] != undefined) {
        if (fileSplitContent[fileSplitContent.length - 1].toLowerCase() != "pdf") {
            $('#imageSource').val(requestURL + $.param(inputData));
            $('#viewImageOnlyForm').submit();
        } else {
            var requestURL = "rest/file/getCapitalRaiseFile?";
            $('#pdFSource').val(requestURL + $.param(inputData));
            $('#viewPdfOnlyForm').submit();
        }
    } else {
        // pop up download attachment dialog box
        downloadIFrame.attr("src", requestURL + $.param(inputData));
    }

}

Jan 04, 2017 5:07:31 AM org.glassfish.jersey.server.ServerRuntime$Responder writeResponse SEVERE: An I/O error has occurred while writing a response message entity to the container output stream. org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Connection reset
Caused by: org.apache.catalina.connector.ClientAbortException: java.net.SocketException: Broken pipe (Write failed)

1

There are 1 best solutions below

0
On

Depending where you access the document this can be because of you have a download manager installed on your browser. This sometimes causes problems - maybe take a look at your extensions. You should try by disabling downloader manager extension in your browser.