costin 01/10/26 14:19:35
Modified: jk build.properties.sample build.xml
jk/java/org/apache/ajp/tomcat33 Ajp14Interceptor.java
jk/java/org/apache/ajp/tomcat4 Ajp13Connector.java
jk/native build.xml
Added: jk interceptors.xml
jk/conf workers.properties
Log:
Few improvements to the build system. Make sure it works fine with 4.0 and 3.3,
genereate 'module' style configuration for 3.3 ( i.e. self-contained webapp ).
Added the sample workers.properties, make sure Ajp14 works.
Revision Changes Path
1.3 +7 -1 jakarta-tomcat-connectors/jk/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/build.properties.sample,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.properties.sample 2001/05/29 23:05:52 1.2
+++ build.properties.sample 2001/10/26 21:19:34 1.3
@@ -2,8 +2,14 @@
# sample build.properties for ajp connector.
# edit to taste...
#
-# $Id: build.properties.sample,v 1.2 2001/05/29 23:05:52 seguin Exp $
+# $Id: build.properties.sample,v 1.3 2001/10/26 21:19:34 costin Exp $
#
+
+# Directory where catalina is installed
+catalina.home=../../jakarta-tomcat-4.0/build
+
+# Directory where tomcat3.3 is installed
+tomcat33.home= ../../jakarta-tomcat/build/tomcat
#
# tomcat 4 internals
1.13 +98 -62 jakarta-tomcat-connectors/jk/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/build.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- build.xml 2001/09/27 10:26:02 1.12
+++ build.xml 2001/10/26 21:19:34 1.13
@@ -1,40 +1,42 @@
<project name="jk" default="build-main" basedir=".">
-
+
+ <!-- We'll build jk for 3.3 or 4.0 ( depending on what you have installed ).
+ You need to set catalina.home and/or tomcat33.home in build.properties
+ ( either the path to 'official' distribution or the development dirs )
+ -->
+
<!-- ===================== Initialize Property Values ================ -->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
+ <property file="${user.home}/.build.properties"/>
<property name="jk.build" value="${basedir}/build"/>
-
- <!-- Should all tests fail if one does? -->
- <property name="test.failonerror" value="true"/>
-
- <!-- The test runner to execute -->
- <property name="test.runner" value="junit.textui.TestRunner"/>
- <property name="test.entry" value="org.apache.ajp.test.TestAll"/>
+ <!-- Compile options -->
<property name="optimize" value="off" />
<property name="debug" value="on" />
<!-- default locations -->
- <property name="tomcat-util.jar"
- location="../util/build/lib/tomcat-util.jar" />
- <property name="tomcat33.src"
- location="../../jakarta-tomcat" />
<property name="tomcat33.home"
- location="${tomcat33.src}/build/tomcat" />
+ location="../../jakarta-tomcat/build/tomcat" />
+ <property name="catalina.home"
+ location="../../jakarta-tomcat-4.0/build" />
- <path id="test.classpath">
- <pathelement location="${jk.build}/classes"/>
- <pathelement location="${tomcat-util.jar}"/>
- <pathelement location="${junit.jar}"/>
- </path>
+ <!-- Need to build tomcat-util before jk, XXX automate -->
+ <property name="tomcat-util.jar"
+ location="../util/build/lib/tomcat-util.jar" />
<path id="build-main.classpath">
<pathelement location="${tomcat-util.jar}"/>
- <pathelement location="${catalina.jar}"/>
- <pathelement location="${servlet.jar}"/>
+ <pathelement location="${catalina.home}/server/lib/catalina.jar"/>
+ <pathelement location="${catalina.home}/common/lib/servlet.jar"/>
<pathelement location="${junit.jar}"/>
+ <pathelement location="${tomcat33.home}/lib/common/tomcat_core.jar"/>
+ <pathelement location="${tomcat33.home}/lib/common/core_util.jar"/>
+ <pathelement
+ location="${tomcat33.home}/lib/container/tomcat_modules.jar"/>
+ <pathelement
+ location="${tomcat33.home}/lib/container/tomcat_util.jar"/>
</path>
<path id="build-tomcat33.classpath">
@@ -43,44 +45,90 @@
<pathelement location="${tomcat33.home}/lib/common/tomcat_core.jar"/>
<pathelement location="${tomcat33.home}/lib/common/core_util.jar"/>
<pathelement
- location="${tomcat33.home}/lib/container/tomcat_modules.jar"/>
+ location="${tomcat33.home}/lib/container/tomcat_modules.jar"/>
<pathelement
location="${tomcat33.home}/lib/container/tomcat_util.jar"/>
- </path>
+ </path>
+
+ <!-- ==================== Detection and reports ==================== -->
+ <target name="report-tc3" if="tomcat33.detect" >
+ <echo message="Tomcat.33 detected " />
+ </target>
+
+ <target name="report-tc4" if="tomcat4.detect" >
+ <echo message="Tomcat4 detected " />
+ </target>
+
+ <target name="report" depends="report-tc3,report-tc4" />
+
<target name="build-prepare">
<mkdir dir="${jk.build}"/>
- <mkdir dir="${jk.build}/classes"/>
- <mkdir dir="${jk.build}/lib"/>
+ <mkdir dir="${jk.build}/logs"/>
+ <mkdir dir="${jk.build}/WEB-INF"/>
+ <mkdir dir="${jk.build}/WEB-INF/conf"/>
+ <mkdir dir="${jk.build}/WEB-INF/classes"/>
+ <mkdir dir="${jk.build}/WEB-INF/lib"/>
+ <copy file="conf/web.xml" tofile="${jk.build}/WEB-INF/web.xml" />
+ <copy file="${tomcat-util.jar}" todir="${jk.build}/WEB-INF/lib" />
+ <copy todir="${jk.build}/WEB-INF" file="interceptors.xml"/>
+ <copy todir="${jk.build}/WEB-INF/conf" >
+ <fileset dir="conf" includes="*" />
+ </copy>
+
+ <available property="tomcat33.detect"
file="${tomcat33.home}/lib/common/tomcat_core.jar" />
+ <available property="tomcat4.detect"
file="${catalina.home}/server/lib/catalina.jar" />
+ <echo message="${tomcat4.detect}
file=${catalina.home}/server/lib/catalina.jar" />
</target>
- <target name="build-main" depends="build-prepare">
+ <target name="build-main" depends="build-prepare,report">
+ <ant dir="../util" antfile="../util/build.xml"/>
<javac srcdir="java"
- destdir="${jk.build}/classes"
+ destdir="${jk.build}/WEB-INF/classes"
deprecation="on"
debug="${debug}"
optimize="${optimize}"
verbose="off"
excludes="**/CVS/**">
- <exclude name="org/apache/ajp/tomcat4/**" if="tomcat4.skip"/>
- <exclude name="org/apache/ajp/tomcat33/**" if="tomcat3.skip"/>
+ <exclude name="org/apache/ajp/tomcat4/**" unless="tomcat4.detect"/>
+ <exclude name="org/apache/ajp/tomcat33/**" unless="tomcat33.detect"/>
<classpath refid="build-main.classpath"/>
</javac>
<!-- Copy static resource files -->
- <copy todir="${jk.build}/classes">
+ <copy todir="${jk.build}/WEB-INF/classes">
<fileset dir="java">
<include name="**/*.properties"/>
</fileset>
</copy>
- <jar jarfile="${jk.build}/lib/ajp.jar"
- basedir="${jk.build}/classes"
+ <jar jarfile="${jk.build}/WEB-INF/lib/ajp.jar"
+ basedir="${jk.build}/WEB-INF/classes"
excludes="org/apache/ajp/test"
/>
+
+ <!-- Old behavior -->
+ <copy todir="${jk.build}"
+ file="${jk.build}/WEB-INF/lib/ajp.jar"/>
</target>
+ <!-- ==================== Tests ==================== -->
+ <!-- XXX move test to it's own dir -->
+
+ <!-- Should all tests fail if one does? -->
+ <property name="test.failonerror" value="true"/>
+ <!-- The test runner to execute -->
+ <property name="test.runner" value="junit.textui.TestRunner"/>
+ <property name="test.entry" value="org.apache.ajp.test.TestAll"/>
+
+ <path id="test.classpath">
+ <pathelement location="${jk.build}/WEB-INF/classes"/>
+ <pathelement location="${tomcat-util.jar}"/>
+ <pathelement location="${junit.jar}"/>
+ </path>
+
+
<target name="test" if="test.entry" depends="build-main"
description="Run all unit test cases">
<java classname="${test.runner}" fork="yes"
@@ -90,7 +138,26 @@
</java>
</target>
+ <!-- ================ Create the helper ant tasks =================== -->
+
+ <target name="jkant" >
+ <property name="jkant.build" location="jkant/build" />
+ <mkdir dir="${jkant.build}" />
+ <mkdir dir="${jkant.build}/classes" />
+ <javac srcdir="jkant/java"
+ destdir="${jkant.build}/classes"
+ debug="${debug}"
+ optimize="${optimize}"
+ verbose="off" >
+ </javac>
+ <mkdir dir="${jkant.build}/classes/META-INF" />
+ <copy todir="${jkant.build}/classes/META-INF" file="jkant/ant.tasks"/>
+ <jar jarfile="${jkant.build}/jkant.jar"
+ basedir="${jkant.build}/classes" />
+ <ant antfile="build.xml" dir="native" />
+ </target>
+
<!-- ================ BUILD: Create Jk Javadocs =================== -->
<target name="javadoc">
<delete dir="${jk.build}/javadoc"/>
@@ -111,36 +178,5 @@
<target name="clean">
<delete dir="${jk.build}"/>
</target>
-
- <!-- ==================== Experimental tomcat33 build ================= -->
-
- <target name="build-tomcat33" depends="build-prepare" >
- <ant dir="../util" antfile="../util/build.xml"/>
- <javac srcdir="java"
- destdir="${jk.build}/classes"
- deprecation="on"
- debug="${debug}"
- optimize="${optimize}"
- verbose="off"
- excludes="**/CVS/**">
- <exclude name="org/apache/ajp/tomcat4/**" />
- <exclude name="org/apache/ajp/test/**" />
- <classpath refid="build-tomcat33.classpath"/>
- </javac>
- <!-- Copy static resource files -->
- <copy todir="${jk.build}/classes">
- <fileset dir="java">
- <include name="**/*.properties"/>
- </fileset>
- </copy>
-
- <jar jarfile="${jk.build}/lib/tc33_ajp.jar"
- basedir="${jk.build}/classes"
- excludes="org/apache/ajp/test" />
-
- <copy todir="${tomcat33.home}/lib/container"
- file="build/lib/tc33_ajp.jar" />
- </target>
-
</project>
1.1 jakarta-tomcat-connectors/jk/interceptors.xml
Index: interceptors.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>
<ContextManager>
<module name="Ajp14"
javaClass="org.apache.ajp.tomcat33.Ajp14Interceptor" />
<Ajp14 debug="10" port="8010" password="secret"/>
</ContextManager>
</Server>
1.1 jakarta-tomcat-connectors/jk/conf/workers.properties
Index: workers.properties
===================================================================
# workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers. Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to do is un-comment and modify the first three
# properties, i.e. workers.tomcat_home, workers.java_home and ps.
# Most of the configuration is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 3 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list property.
#
#
# OPTIONS ( very important for jni mode )
#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=$(TOMCAT_HOME)
# workers.tomcat_home=/usr/local/tomcat
#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=$(JAVA_HOME)
# workers.java_home=/usr/java
#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
# ps=\
#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#
#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
# Add 'inprocess' if you want JNI connector
worker.list=ajp13,ajp14, inprocess
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp14.port=8010
worker.ajp14.host=localhost
worker.ajp14.type=ajp14
worker.ajp14.secretkey=secret
worker.ajp14.credentials=myveryrandomentropy
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp14.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.ajp14.cachesize
#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#
#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
#
#------ DEFAULT JNI WORKER DEFINITION---------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named inprocess and of type jni
# Note that the name and the type do not have to match.
#
worker.inprocess.type=jni
#
#------ CLASSPATH DEFINITION -----------------------------------------
#---------------------------------------------------------------------
#
#
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
#
# Setting the command line for tomcat.
# Note: The cmd_line string may not contain spaces.
#
worker.inprocess.cmd_line=start
# Not needed, but can be customized.
#worker.inprocess.cmd_line=-config
#worker.inprocess.cmd_line=$(workers.tomcat_home)$(ps)conf$(ps)server.xml
#worker.inprocess.cmd_line=-home
#worker.inprocess.cmd_line=$(workers.tomcat_home)
#
# The JVM that we are about to use
#
# This is for Java2
#
# Windows
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
# IBM JDK1.3
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so
# Unix - Sun VM or blackdown
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)classic$(ps)libjvm.so
#
# And this is for jdk1.1.X
#
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll
#
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
#
# Setting the tomcat.home Java property
#
#worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#
# Java system properties
#
# worker.inprocess.sysprops=java.compiler=NONE
# worker.inprocess.sysprops=myprop=mypropvalue
#
# Additional path components.
#
# worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin
#
1.7 +12 -6
jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java
Index: Ajp14Interceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp14Interceptor.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Ajp14Interceptor.java 2001/06/27 15:55:28 1.6
+++ Ajp14Interceptor.java 2001/10/26 21:19:35 1.7
@@ -97,18 +97,25 @@
public Ajp14Interceptor()
{
super();
+ super.setSoLinger( 100 );
+ super.setTcpNoDelay( true );
}
// initialization
public void engineInit(ContextManager cm) throws TomcatException {
+ log("engineInit");
+ }
+
+ public void engineStart(ContextManager cm) throws TomcatException {
super.engineInit( cm );
ajp14_note=cm.getNoteId( ContextManager.REQUEST_NOTE, "ajp14" );
- }
+ super.engineStart(cm);
+ }
+
// -------------------- Ajp14 specific parameters --------------------
public void setPassword( String s ) {
- log( "Password=" + s);
this.password=s;
}
@@ -136,6 +143,7 @@
*/
public Object[] init()
{
+ if( debug > 0 ) log("Init ");
Object thData[]=new Object[1];
thData[0]=initRequest( null );
return thData;
@@ -164,7 +172,6 @@
ajp14.setContainerSignature( ContextManager.TOMCAT_NAME +
" v" + ContextManager.TOMCAT_VERSION);
BaseRequest ajpreq=new BaseRequest();
- log( "Setting pass " + password );
ajp14.setPassword( password );
req=new Ajp14Request(ajp14, ajpreq);
Ajp14Response res=new Ajp14Response(ajp14);
@@ -178,6 +185,8 @@
public void processConnection(TcpConnection connection, Object thData[])
{
try {
+ if( debug>0)
+ log( "Received ajp14 connection ");
Socket socket = connection.getSocket();
// assert: socket!=null, connection!=null ( checked by PoolTcpEndpoint )
@@ -189,9 +198,6 @@
BaseRequest ajpReq=req.ajpReq;
ajp14.setSocket(socket);
-
- if( debug>0)
- log( "Received ajp14 connection ");
// first request should be the loginit.
int status=ajp14.receiveNextRequest( ajpReq );
1.7 +17 -7
jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java
Index: Ajp13Connector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Ajp13Connector.java 2001/10/08 20:18:12 1.6
+++ Ajp13Connector.java 2001/10/26 21:19:35 1.7
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java,v
1.6 2001/10/08 20:18:12 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2001/10/08 20:18:12 $
+ * $Header:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java,v
1.7 2001/10/26 21:19:35 costin Exp $
+ * $Revision: 1.7 $
+ * $Date: 2001/10/26 21:19:35 $
*
* ====================================================================
*
@@ -93,7 +93,7 @@
* Implementation of an Ajp13 connector.
*
* @author Kevin Seguin
- * @version $Revision: 1.6 $ $Date: 2001/10/08 20:18:12 $
+ * @version $Revision: 1.7 $ $Date: 2001/10/26 21:19:35 $
*/
@@ -739,7 +739,12 @@
// If no address is specified, open a connection on all addresses
if (address == null) {
logger.log(sm.getString("ajp13Connector.allAddresses"));
- return (factory.createSocket(port, acceptCount));
+ try {
+ return (factory.createSocket(port, acceptCount));
+ } catch(Exception ex ) {
+ ex.printStackTrace();
+ return null;
+ }
}
// Open a server socket on the specified address
@@ -748,8 +753,13 @@
logger.log(sm.getString("ajp13Connector.anAddress", address));
return (factory.createSocket(port, acceptCount, is));
} catch (Exception e) {
- logger.log(sm.getString("ajp13Connector.noAddress", address));
- return (factory.createSocket(port, acceptCount));
+ try {
+ logger.log(sm.getString("ajp13Connector.noAddress", address));
+ return (factory.createSocket(port, acceptCount));
+ } catch( Exception e1 ) {
+ e1.printStackTrace();
+ return null;
+ }
}
}
1.2 +12 -0 jakarta-tomcat-connectors/jk/native/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/build.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.xml 2001/10/26 19:53:45 1.1
+++ build.xml 2001/10/26 21:19:35 1.2
@@ -10,7 +10,18 @@
<taskdef resource="META-INF/ant.tasks"
classpathref="jkant" />
+ <property name="apxs13" value="/usr/sbin/apxs" />
+ <property name="apxs20" value="/opt/apache2/bin/apxs" />
+
<target name="main" >
+ <!-- Guess/extract configuration informations
+ -->
+ <configJni id="jni" />
+ <configApache13 id="apache13" />
+ <configApache2 id="apache2" />
+ <!-- configIIS id="iis" />
+ <!-- configNES id="nes" />
+
<so sofile="jni_connect" >
<src dir=".">
<include name="jni/jk_jnicb.c" />
@@ -23,6 +34,7 @@
<pathelement path="${java.home}/include/${os.name}" />
<pathelement location="../common" />
</includes>
+ <cfg refid="jni" />
</so>
</target>