Free Support Forum -

Can't connect to server



We’re running GroupDocs.Viewer Java on an AWS hosted Linux instance.

We’ve had an issue recently where any time a PDF file was loaded, it failed with a ‘Can’t connect to server’ error. We restarted Tomcat and the issue resolved itself and now PDFs load fine.

We load files through the use of a custom data input handler.

Is there a known issue where if a Tomcat instance has been running for sometime that these ‘Can’t connect to server’ errors can appear? Could it be due to a memory leak of some kind?

No exception is thrown, or any error of any kind (other than the ‘Can’t connect to server’ error message displayed to the user) is produced.

Do you know what kind of things can cause the ‘Can’t connect to server’ error message to be displayed?


Hello Simon,

We are really sorry that you have the issue, but we can't reproduce it on our side. Could you please specify does the issue occurs only with specific document or with different? Does the file has a big size and how many pages it has? From your issue description we can assume that yes the issue can occurs when the JVM have not virtual memory for processing the file. So, please try to increase JAVA_OPTS -Xms and -Xmx.

If this not help you, then please prepare simple demo project with problem file that will reproduce the issue. We will investigate it and will be glad to help you.

We will wait for your results.


Best regards,
Evgen Efimov
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+

Hi Evgan,

The issue only only started this week after the Tomcat server had been running for several weeks. I can't just reproduce the problem as when I restarted Tomcat the issue resolved itself. It was only PDFs, although any size PDF with any number of pages - all PDFs stopped rendering.

I could potentially increase the -Xmx, although it's already set at -Xmx4096m.

What I'm more interested in however, is, in the GroupDocs.Viewer code what problem has to occur for a 'Can't connect to server' error to be displayed. If you can tell me under what circumstances you display that error, I can try and figure out what happened.

Is there any any additional logging I can turn on, so if in a few weeks time it happens again I'll have more information to debug with?

Otherwise this is going to be impossible do debug as it takes so long for the issue to present itself.


Hello again,

Basically, this "Can't connect to server" error thrown not from our library . Its thrown by the browser, when it can't get response from the server. So it can occurs, when on server side the library works with file and it does not have time to return processed file to frontend.

If you interested in the performance increasing of the library you can do the following:

1. Try to use HTML-based rendering mode ("groupdocs.viewer.useHtmlBasedEngine=true" method) if it is suitable for you and there are no document distortions.
2. Use "groupdocs.viewer.preloadPagesCount=1" method. When using this method GroupDocs.Viewer will begin to load document to the client-side when first page of the document will be converted. When this method doesn't used, GroupDocs.Viewer converts all pages of a document and only then sends it to the client-side.
3. Use "groupdocs.viewer.minimumImageWidth=(value)" method. If it set, the Viewer will load page images with the specified width from the server when starting. It will not load page images from the server again after zooming if the current page image size is smaller than the value specified and if the original (not scaled) page image size is smaller than the value specified. It means that in most cases the GroupDocs.Viewer will load page images only once and will not reload them after zooming in/out.
4. If this is possible for your business-logic, disable thumbnails ("groupdocs.viewer.showThumbnails=false").
5. If this is possible for your business-logic, disable ability to select text by using "groupdocs.viewer.supportTextSelection=false" method.
6. Use "groupdocs.viewer.showViewerStyleControl=false" method - it will disable "double page flip" option and will increase performance.

Also we think that you can try to increase timeout settings for your web server.


Best regards,
Evgen Efimov
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+