First of all, here are the exact versions I'm running. I wouldn't be surprised if there are newer major versions; I need to upgrade the server.
- Apache2: 2.2.11
- Tomcat: 6.0.18
- First we need to enable proxy_ajp on Apache2. The proxy and proxy_balancer modules are required, but they'll be enabled as needed by
a2enmod
.
$ sudo a2enmod proxy_ajp Considering dependency proxy for proxy_ajp: Enabling module proxy. Enabling module proxy_ajp. Run '/etc/init.d/apache2 restart' to activate new configuration!
- Next we need to add the proxy rule for Apache2 in /etc/apache2/conf.d/proxy_ajp, which I had to create. You can add as many of these blocks as you need, but the contexts must be unique, i.e. you can't create two proxies to talk to the same webapp. Paste the following into the proxy_ajp conf file, replacing
WEBAPP
with the context of the webapp for which the proxy is being setup.
ProxyPass /WEBAPP ajp://localhost:8009/WEBAPP ProxyPassReverse /WEBAPP ajp://localhost:8009/WEBAPP <Proxy /WEBAPP> Order deny,allow Allow from all </Proxy>
- Finally, we need to enable the AJP connector in Tomcat. To do so, simply uncomment the following line in /etc/tomcat6/server.xml. Of course you can change the port as desired, but make sure the change is applied to the proxy_ajp conf file as well.
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
- Restart Tomcat.
sudo /etc/init.d/tomcat6 restart
- Restart Apache2.
sudo /etc/init.d/apache2 restart
Jun 26, 2011 9:35:17 PM org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 18245
Jun 26, 2011 9:35:17 PM org.apache.jk.common.ChannelSocket processConnection
SEVERE: Error, processing connection
java.lang.IndexOutOfBoundsException
at java.io.BufferedInputStream.read(BufferedInputStream.java:327)
at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:636)
Most likely I had a mistake in the proxy_ajp file, because all it took was to restart Apache2 again, and I haven't seen the error since.
Thanks a lot. It's surprising how hard it is to find just this information.
ReplyDelete