The Jetty folks have been working hard on improving the connectivity between apache and jetty and so from 4.1.D2 Jetty has shipped with its own AJP13 Listener. According to Greg Wilkins, the currently shipped version has problems with authenticated and SSL connections, but these are solved in the latest CVS version.
Attached is a HOWTO on getting Jetty and Apache 2 talking via mod_jk2. Can I please get some feedback on this? And what do people think about this (or something similar) being included in the next release of the jtc? Regards, Simon -- "I like to fill my tub up with water, then turn the shower on and act like I'm in a submarine that's been hit ..." Steven Wright
Using mod_jk2 and Jetty ======================= Jetty is a popular Open Source HTTP Server and Servlet container, written in 100% pure Java. It supports serving static content, servlets and JSPs, and is fast and lightweight. It is commonly used as an embedded HTTP and servlet container, notably by JBoss (a full featured J2EE environment) Jetty's current developement branch is 4.1. This is working to enhance the performance of the server, as well as to improve its support for apache integration. To further this support, since 4.1.D2 Jetty has shipped with an AJP13 connector, meaning that it can communicate using the mod_jk and mod_jk2 apache modules in addition to working as a standalone server. This document aims to provide a guide for using this facility. Normal, authenticated and SSL connections are all supported, so in theory, Jetty could be used as a "drop in" replacement for Tomcat. In order to keep things as simple as possible, this document only considers apache2 and mod_jk2. This is the successor to mod_jk, and uses the same protocol, so using the older module should not cause any problems. The process will be very similar to installing jk2 on any server, so if you are using IIS or iPlanet, simply follow the normal installation notes for jk2 on those platforms, ignoring any references to compiling the java code. Once the native side of the AJP13 connector is installed, skip to the section on "Configuring Jetty" Building ======== * Install apache, ensuring that DSO support is available. * Install any version of Jetty from 4.1.D2 onwards. * Copy build.properties.sample to build.properties * Edit build.properties to taste. In particular it's important to set the path to apache2. * Run "ant native" to build the native connectors for the detected servers (both jk and jk2) It is possible to use configure/make/dsp/apxs, but this way is simpler. * Copy the created build/apache2/mod_jk2.so to your apache installation's module directory. Configuring Apache 2 ==================== On the native side, jk2 is configured using the workers2.properties file that is kept in apache's conf directory. Currently Jetty's AJP connector supports TCP/IP socket connections. Perhaps the simplest way to explain things is with an example workers2.properties file: ---- workers2.properties # Example socket channel, override port and host. [channel.socket:localhost:8009] port=8009 host=127.0.0.1 # define the worker [ajp13:localhost:8009] channel=channel.socket:localhost:8009 # Uri mapping. This says that any incoming connection to any file # under "/jetty/" should be handled the worker defined above [uri:/jetty/*] worker=ajp13:localhost:8009 # The same, but for /demo [uri:/demo/*] worker=ajp13:localhost:8009 ---- end worker2.properties An "apachectl configtest" should report no errors. You should configure the URI mappings to cover any installed webapps that you may have. The examples given here are for the demo apps that come with a fresh download of Jetty. Configuring Jetty ================= Jetty is easy to configure. At a bare minimum, all that needs to be done is to simply include the following fragment in Jetty's configuration file (typically found at etc/jetty.xml): <Call name="addListener"> <Arg> <New class="org.mortbay.http.ajp.AJP13Listener"> <Set name="port">8009</Set> </New> </Arg> </Call> Once this is place, it should be possible to start Jetty and then (re)start apache. Check that everything works as expected by visiting port 8080 of your server with a web browser. If doesn't work then you have a problem with your Jetty config. Assuming that you can connect properly to Jetty directly, it's time to connect using jk2. Check that your webserver is running as expected by pointing a browser at the homepage (for example, http://localhost/ ) If this works, attempt to visit one of the mapped URIs. Congratulations! Jetty Config Options ==================== The Jetty AJP13 connector has a compact set of configuration options. These are: ---- Jetty config options bufferSize Size of the AJP13 data buffers (default 8192) confidentialPort The port to redirect to if a servlet security constraint of CONFIDENTIAL is not met. (default 0 : forbidden response). confidentialScheme The scheme to use for confidential redirections (default https) host The host or IP interface to listen on. (default 0.0.0.0 == all interfaces) identifyListener Set the listener name as a request attribute (false) lingerTimeSecs The socket linger time for closing sockets (30) maxIdleTimeMs Millisecs that a thread can be idle before the thread pool shrinks. maxReadTimeMs Millisecs that a read will block on a connection. maxStopTimeMs Millisecs to wait when gently shutting down listener. maxThreads Maximum threads in threadpool for listener. minThreads Minimum threads in threadpool for listener. name Name of the listener. port Port to listen on (8009) threadClass The class to use for threads in the threadpool. ---- End Jetty config options Most of these default to sensible values, and some of them (such as bufferSize) are unwise to fiddle with. An example of using these config options is given below. <Call name="addListener"> <Arg> <New class="org.mortbay.http.ajp.AJP13Listener"> <Set name="Port">8009</Set> <Set name="MinThreads">5</Set> <Set name="MaxThreads">50</Set> <Set name="MaxIdleTimeMs">30000</Set> <Set name="MaxReadTimeMs">60000</Set> </New> </Arg> </Call>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>