I\'m trying to resolve an issue about connecting Apache and Tomcat with mod_proxy_ajp. In my case, the Tomcat stops to response the Apache, and the apache log prints logs er
Add connectionTimeout and keepAliveTimeout to your AJP connector found in /etc/tomcat7/server.xml.
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
connectionTimeout="10000" keepAliveTimeout="10000" />
Info about the AJP connector at https://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html
connectionTimeout = The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. The default value for AJP protocol connectors is -1 (i.e. infinite).
keepAliveTimeout = The number of milliseconds this Connector will wait for another AJP request before closing the connection. The default value is to use the value that has been set for the connectionTimeout attribute.
If connectionTimeout and keepAliveTimeout values is not defined, then AJP connections will be kept alive for infinite. Causing to many threads, default max threads is 200.
I recommend installing psi-probe - an advanced manager and monitor for Apache Tomcat, forked from Lambda Probe. https://code.google.com/p/psi-probe/
I am using tomcat 8 with apache 2.2 and Centos, found the issue saying:
[error] ajp_read_header: ajp_ilink_receive failed
[error] (70007)The timeout specified has expired: proxy: read response failed
The solution I applied and it worked perfect:
1. Configure Apache 'MaxClients' to be equal to the Tomcat AJP 'maxConnections' configuration.
2. Configure Tomcat AJP 'keepAliveTimeout' to close connections after a period of inactivity.
Here is an example from tomcat server.xml:
<Connector port="8009" protocol="AJP/1.3" maxConnections="256" keepAliveTimeout="30000" redirectPort="8443" />
vote for answer if you liked this solution. cheers
Try this :
"org.apache.coyote.ajp.AjpProtocol"
instead the APR. a very good explanation of the problem and how to solve it can be found at http://javaworkbench.blogspot.co.at/2013/09/apache-web-server-tomcat-ajp.html.
in short: - Configure Apache 'MaxClients' to be equal to the Tomcat AJP 'maxConnections' configuration. - Configure Tomcat AJP 'keepAliveTimeout' to close connections after a period of inactivity.