AJP Protocol Reference
General Informations and FAQ about JK
|Where can I get help/support for JK ?|
The primary mechanism for support is through the JK
documentation included in the doc directory.
Documentation is also available on the Apache Tomcat web site devoted to the
Apache Tomcat Connectors Project
For additional help, the best resource is the Tomcat Users Discussion list.
You should start by searching
the mail list archive
before you post questions to the list.
If you are unable to locate the answer to your question in the archive,
you can post questions about JK to the user list for assistance.
Make sure that you include the version of your Webserver,
that you are using as well as the platform you are running on
to determine how to subscribe to tomcat mailing list.
|Which protocol should I use? Ajp12 or Ajp13?|
Ajp13 is a newer protocol, it's faster, and it works better with SSL.
You almost certainly want to use it now that ajp12 is deprecated.
Also ajp13 is supported by all Apache Tomcat including 3.2.x , 3.3.x, 4.0.x, 4.1.x, 5.0.x, 5.5.x
and the new tomcat 6.
Others Servlet engines like jetty have support for Ajp13.
|Under heavy load, I've got many threads in Tomcat even if my Apache Web Server handles much of the load|
Under heavy load, Apache Web Server creates many children to handle the load,
which will in turn create many connections
to Tomcat to forward the requests they should handle.
Apache Web Server will normally kill the children/threads when the load decreases.
But if the load is still there and even if only Apache handles the requests,
ie static contents, the children are kept and with them all the ajp13 connections,
even if they are no more used.
To close connections after some time of inactivity you can use connection_pool_timeout,
for more informations refer to workers.properties reference.
Informations and FAQ about mod_jk and Apache Web Servers.
|Whenever I restart Tomcat, Apache locks up!|
The Ajp13 protocol keeps an open socket between Tomcat and Apache.
Release of mod_jk present in J-T-C handles the network failure.
But with very ancient releases of mod_jk, you may have to restart Apache as well.
|Why do there exist two files mod_jk.so (-eapi ad -noeapi) in download directories for Apache 1.3?|
Many versions of Apache use a modified API, known at Extended API, developed for use with the
mod_ssl module. Starting with Apache 2.0 there is no more difference.
For example, Apache 1.3 present in certains recent Linux distributions include the
So if you got such 'Extended Apache', you need to use mod_jk.so-eapi.
You should use mod_jk.so-noeapi only for 'Standard Apache' (ie without mod_ssl).
It's wise to avoid using EAPI modules on STD API Apache or to use standard API modules on EAPI Apache.
Allways be sure to have the mod_jk.so witch match your version of Apache
|What's that message about 'garbled DSO ?'|
It's related to Apache EAPI, the message 'mod_jk.so is garbled - perhaps this is not an Apache module DSO ?'
just told you, that your're trying to install a mod_jk.so DSO module that was compiled on an Apache using EAPI,
like apache-mod_ssl or apache from Redhat distro 6.2/7.0 but your system use the standard apache with normal API.
|And the message about 'module might crash under EAPI!|
Also related to EAPI, the message '[warn] Loaded DSO /usr/lib/apache/mod_jk.so uses plain Apache 1.3 API,
this module might crash under EAPI! (please recompile it with -DEAPI)', the mod_jk.so was compiled under normal
Apache with standard API and you try to install the module on an Apache using EAPI.
|APXS is getting an error during the build of mod_jk, like rc=0 or rc=255. I tried all of the steps in the build section, what do I do now ?|
APXS is a Perl script that is created when you build the Apache web server from source.
Chances are that if you are getting these errors and you obtained Apache as a binary distribution,
that APXS is not configured correctly for your system.
Your best bet is to get the Apache source from http://httpd.apache.org and build it yourself.
Use the following for a basic build (read the Apache docs for other options):
[user@host] ~ $ cd /usr/local/src
[user@host] ~ $ gzip -dc apache_1.3.19.tar.gz|tar xvf -
[user@host] ~ $ cd apache_1.3.19
[user@host] ~ $ ./configure --prefix=/usr/local/apache \
[user@host] ~ $ --enable-module=most \
[user@host] ~ $ --enable-shared=max
[user@host] ~ $ make
[user@host] ~ $ make install
Note: The above steps assume that you downloaded the Apache source and placed it in your /usr/local/src directory.
|Apache 2.0 complains about incorrect module version|
Since Apache 2.0 API still change often, the Apache 2.0 teams decide to put in headers of compiled modules the
Apache 2.0 version used to compile the module. This check is called Magic Module Number bump.
At start time Apache 2.0 check that version in modules headers and stop if it detect that a module was compiled
for another Apache 2.0 version. As such you should allways use modules compiled for the same Apache 2.0 version.
This check may be removed if the future.
|Does it work for Apache 2.2?|
mod_jk works well with Apache 2.2. You need a binary module compiled for version 2.2 of the Apache web server.
A binary compiled for version 2.0 will not work.
Important parts of the functionality of mod_jk have been reimplemented as Apache httpd modules mod_proxy_ajp
and mod_proxy_balancer. These are part of the standard distributoin of Apache 2.2. The new modules do not contain
all features of mod_jk, but you get them automatically with every Apache 2.2.
|JNI doesn't work with Apache 1.3|
JNI support requires a multi-threaded environment which is not the general case for Apache 1.3.
You should verify if Apache 1.3 has been build with thread support and if not you could add the
the pthreads library to your httpd.conf file.
# Add pthread to Apache in httpd.conf
Also keep in mind that JNI is suited for multi-threaded servers and you should consider upgrading
to Apache 2.x to support JNI.
|JNI report that JVM couldn't be started under Linux|
Under Linux, you should set some environment variables BEFORE launching your Apache server :
Also some Linux distributions have enabled a GLIBC feature called 'floating stacks' which may not works with kernel
less than 2.4.10 on SMP machines. You should disable floating stacks by exporting an environment variable :
You could have to update your service scripts, ie /etc/rc.d/init.d/httpd, to set these env vars
before your httpd server starts.
|Mixed errors when building via configure|
configure assume you have some GNU tools already installed and configured for your system, and ad minima libtool.
Also some systems may have mixed cc and gcc setup which may make you puzzled when trying to link an Apache built with native
c compiler with a jk/jk2 build with gcc.
In case the make processing doesn't work as expected, you should use a GNU make gmake.