haxx qua non

Tomcat AJP/1.3 Connector issues

by jja on

The documentation for Tomcat 6.0.18 AJP/1.3 Connectors is incomplete and misleading. It seems to indicate that there is exactly one class for AJP, but there are actually three and the one you get may not match the documentation.

I tried to use the new executor but kept getting exceptions like:

[DATE] org.apache.catalina.startup.ConnectorCreateRule _setExecutor

WARNING: Connector [org.apache.catalina.connector.Connector@11e1e67] does not
support external executors. Method setExecutor(java.util.concurrent.Executor)
not found.

I found nothing useful on the web about this or in Tomcat's bugzilla. I submitted a report (Bug 46923) based on what I describe below. It is supposed to be fixed in 6.0.20 (and is in the online trunk (but not in the 6.0.x trunk)). Digging into the source, I found there are three AJP protocol classes available:

The default [Connector](http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html) class, uses the protocol property to pick which class to use (for this example, that's AJP/1.3), but the key is that it also checks if APR is initialized. I've never gotten APR working on my Redhat boxen and so got the exception above. If APR is not initialized, JkCoyoteHandler is the protocol class used, which does not implement most of the features listed in the documentation that are implemented by AjpAprProtocol and AjpProtocol. I don't know why AjpProtocol isn't used. It seems to work fine. The two classes are virtually identical (and could be refactored), relying on [AjpAprProcessor](http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpAprProcessor.html) or [AjpProcessor](http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html) to do the heavy lifting, which isn't marked experimental or anything.

To use AjpProtocol, specify the full class name for the protocol:

<Connector port="8009"
    protocol="org.apache.coyote.ajp.AjpProtocol" executor="tomcatThreadPool" ...

To figure out if your APR is working, check your Tomcat logs (e.g. catalina.err, catalina.DATE.log) for something like:

INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the

BTW, for HTTP/1.1 you get one of these, depending on APR:


Clustering Tomcat « Teh Tech Blogz0r by Luke Meyer commented at 2010-08-13 21:01:02

[...] really know why the APR isn't working properly, but a little searching turned up some obscure facts: if the APR isn't loaded, then for the AJP connector Tomcat makes a default choice of [...]

(comments are closed)