Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Connecting Apache httpd to Apache Tomcat

Posted by admin (Graham Ellis), 10 December 2004
If you're running Tomcat, chances are you're running Apache httpd (often just known as "Apache" for historic reasons) too.

Tomcat provides a Web interface to containers for running Java Applications.  In other words, it acts as a web server, but it's certainly not a general purpose web server that you would use throughout a typical site which comprises mainly static informational pages, with some straightforward scripts in a language such as PHP that's ideal for such purposes.  Indeed - Tomcat is so much biased towards Java and httpd is so biased to more general work that it's more common than not for web sites with a Java element to run both.

You can't run two web servers at the same location (at the same IP address, and on the same port number), If you managed to start them both, they would both attempt to answer all requests made and that would result in a babble that the client process couldn't understand.   So how do you run them together?   Choose htttpd to take the lead, and have it call through to Tomcat if the URL that a client gives requires attention from the Java engine (Tomcat). There are a number of ways this can be done.

a) Proxying a request.  If httpd picks up a certain pattern in the URL (it can recognise it using a regular expression), it makes an ongoing http request to Tomcat on a differnt port (and / or on a different computer).  In other words, it becomes a client to the Tomcat server.  And it passes the result back to the originator, who isn't aware that the request was passed on.   Easy to set up, but not operationally efficient if there's lots of requests.

b) Using a JK connector. This uses the AJP protocol rather that HTTP between hpptd and Tomcat. To quote the Apache Tomcat documentation -  """This is used for cases where you wish to invisibly integrate Tomcat 4 into an existing (or new) Apache installation, and you want Apache to handle the static content contained in the web application, and/or utilize Apache's SSL processing. In many application environments, this will result in better overall performance than running your applications under Tomcat stand-alone using the HTTP/1.1 Connector. However, the only way to know for sure whether it will provide better performance for your application is to try it both ways.""".  However - it adds IMPORTANT NOTE: The JK connector is now deprecated. Use the Coyote JK 2 connector instead.

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/jk.html

c) Using a JK2 connector. This uses a more advanced connection technology than JK was was designed to be more efficient, However - as of 15th November 2004: """JK2 is officially unsupported.  JK2 has been put in maintainer mode and no further development will take place. The reason for shutting down JK2 development was the lack of developers interest. Other reason was lack of users interest in adopting JK2, caused by configuration complexity when compared to JK."""

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/

d) Using a Warp connector.  This was going to be "the connector of the future" a while back - it's more recent than the three options already listed, but platform limitations and other issues lead to it being stillborn and references seem to be fading fast.

e) Re-vitalised JK connector.  On 30th November 2004, we read """The Apache Jakarta Tomcat team is proud to announce the immediate availability of Jakarta Tomcat Connectors 1.2.7-beta. The release contains a significant number of bug fixes and new features.""" At the date of writing this (10th December 2004) there is no production release .... but keep you eyes on

http://jakarta.apache.org/tomcat/connectors-doc/

My Advise?

If you're in the process of setting up a new system today, use option (a) - Proxying.  It's easy to set up, it works, and it's unlikely to be deprecated.   You may have a few performance issues on a very busy system - but then if you're just developing a system today you'll only be testing it for a month or two by which time you should be able to switch to the new JK if you need to.  I'm hoping that this advice will change early in 2005 but, frankly, I can't recommend any of the other options just at the moment and I'm not sure how much you'll need them in most cases anyway!

Looking ahead to the future ... """JK2 will have it's successor within core Apache2.1/2.2 distribution. We have developed new proxy_ajp that is an addition to the mod_proxy and uses Tomcat's AJP protocol stack. It is developped in httpd-2.1 and integrated in it. We have also developed a new proxy_balancer module for load balancing http and ajp protocol stacks. JK will be fully supported for all other web servers. The next JK release is planned for the end of November. Lots of code from JK2 has been ported to JK""".

http://jakarta.apache.org/tomcat/connectors-doc/news/20041100.html



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho