Search code examples
javaapachetomcatjasperserver

Request Entity Too Large (JasperServer / Apache / Tomcat)


I get following error when I try to access some JasperReports Server pages:

Request Entity Too Large The requested resource /jasperserver/olap/viewOlap.html does not allow request data with GET requests, or the amount of data provided in the request exceeds the capacity limit.

I checked the Apache log files and got following error in mod_jk.log

[Thu Nov 10 10:25:00 2016][8964:3876] [error] ajp_marshal_into_msgb::jk_ajp_common.c (517): failed appending the query string of length 7417

I already tried many different ways to solve it.

I added the maxHttpHeaderSize and max_packet_size attributes to the ajp connect of Tomcat (server.xml):

<Connector port="8010" protocol="AJP/1.3" connectionTimeout="20000" redirectPort="8443" maxHttpHeaderSize="65536" max_packet_size="65536" />

Also I added the LimitRequestLine, LimitRequestBody, LimitRequestFieldSize and LimitRequestFields to the Apache httpd.conf file (added it to the end of the file without any VirtualHost):

LimitRequestLine 65536 LimitRequestBody 0 LimitRequestFieldSize 65536 LimitRequestFields 10000

I am still getting the error above.

I also found some suggestions to add the max_packet_size to the workers.properties of Apache. But if I add the attribute I get a HTTP 400 error and a white page. That's why I commented the property in workers.properties:

#worker.jasper.max_packet_size=65536

I restarted all services after changing the configurations.

When I access the same pages via HTTP-Connector of Tomcat (http://HOSTNAME:8081/jasperserver/..) it works fine. Only when I access it via AJP-Connector of Apache (http://HOSTNAME/jasperserver/..) I get the error. So I think there should be any problem with the AJP-Connector.

Apache: 2.4.12 JasperReports Server: 6.2.1 Apache Tomcat Version 8.0.14:

Does anyone have a suggestion what I have to do to solve the issue?


Solution

  • I figured out the problem.

    The attribute in server.xml for Tomcat has to be packetSize and not max_packet_size

    See also documentation AJP Connector

    After renaming it, it works fine.

    Here are my configurations:

    Tomcat server.xml:

    Connector port="8010" protocol="AJP/1.3" redirectPort="8443" packetSize="65536"

    Apache workers.properties:

    worker.jasper.max_packet_size=65536

    If you get afterwards the error:

    Request-URI Too Long

    The requested URL's length exceeds the capacity limit for this server.

    You have to set following attributes in Apache httpd.conf file:

    LimitRequestLine 65536 LimitRequestBody 0 LimitRequestFieldSize 65536 LimitRequestFields 10000

    I hope this answer helps others too.