Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2001 15:37:27 -0600 (CST)
From:      Tim Zingelman <zingelman@fnal.gov>
To:        <freebsd-java@FreeBSD.ORG>
Subject:   Tomcat for BSD (was: RE: Trying to Create a simple Bean)
Message-ID:  <Pine.GSO.4.30.0103081437590.15709-400000@nova.fnal.gov>
In-Reply-To: <9FD1AD5A8A0EB94B8B41ABC47563ED4B3B67@exchange1.crossoft.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Thu, 8 Mar 2001, Drew Lister wrote:

> Two other questions though.  Hopefully these aren't too elementary.
>
> 1.  Is there a Tomcat installation for BSD?

/usr/ports/www/jakarta-tomcat has tomcat 3.1 (which is old)

If you replace the three files I attached to this email in that directory,
it will install tomcat 3.2.1 which I think is the current release.

If this works well for you, I'll submit a request to get these changes
committed to the ports tree... at this point no one but me has used them.

The makefile has the RUN_DEPENDS= line commented out, since it would
otherwise install the native 1.1.8 jdk, which is not what I wanted...

Other steps I took so tomcat would work with apache and run as nobody
instead of root:

  cd /usr/local/tomcat/conf
  vi server.xml (add:
<!-- Apache AJP13 support. This is faster than AJP12
  -->
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
    <Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
    <Parameter name="port" value="8009"/>
</Connector>
                )
  touch mod_jk.conf-auto tomcat-apache.conf iis_redirect.reg-auto
obj.conf-auto
  touch uriworkermap.properties-auto
  chown nobody.nogroup tomcat-apache.conf *-auto

  cd /usr/local/etc/apache
  vi httpd.conf (add at the end:
    Include /usr/local/tomcat/conf/mod_jk.conf
                )
  ln -s /var/log /usr/local/tomcat/logs
  ln -s /tmp /usr/local/tomcat/work
  cd /var/log
  touch tomcat.log servlet.log jasper.log jk.log jvm.stderr jvm.stdout
  chown nobody.nogroup tomcat.log servlet.log jasper.log jk.log
  chown nobody.nogroup jvm.stderr jvm.stdout

I edited /usr/local/etc/rc.d/apache.sh to set some environment variables
and also start & stop tomcat...

TOMCAT_HOME=/usr/local/tomcat
TOMCAT_OPTS=-classic
JAVA_HOME=/usr/local/linux-jdk1.3.0
export TOMCAT_HOME TOMCAT_OPTS JAVA_HOME
case "$1" in
start)
        [ -x /usr/local/tomcat/bin/startup.sh ] && /usr/bin/su -m nobody -c '/usr/local/tomcat/bin/startup.sh'; sleep 2
        [ -x ${PREFIX}/sbin/apachectl ] && ${PREFIX}/sbin/apachectl start > /dev/null && echo -n ' apache'
        ;;
stop)
        [ -r /var/run/httpd.pid ] && ${PREFIX}/sbin/apachectl stop > /dev/null && echo -n ' apache'; sleep 2
        [ -x /usr/local/tomcat/bin/shutdown.sh ] && /usr/bin/su -m nobody -c '/usr/local/tomcat/bin/shutdown.sh'
        ;;
*)
        echo "Usage: `basename $0` {start|stop}" >&2
        ;;
esac

exit 0

You will also need to build a mod_jk.o shared library to hook tomcat to
apache... here's the diff to the makefile included in the apache tarball:
  jakarta-tomcat-3.2.1-src.tar.gz

Despite the fact that the file was named Makefile.freebsd, I needed to
make the following changes to make it work with linux-jdk1.3.0 and apache
1.3.x from ports.

jakarta-tomcat-3.2.1-src/src/native/apache1.3/Makefile.freebsd

--- Makefile.freebsd.orig    Tue Dec 12 16:51:55 2000
+++ Makefile.freebsd.new
Sat Feb 24 01:26:52 2001
@@ -1,18 +1,12 @@
-## You need to edit this file - configure later :-)
+OS=linux
+APXS=/usr/local/sbin/apxs

-APACHE_HOME=/usr/local/apache
-OS=freebsd
-APXS=${APACHE_HOME}/bin/apxs
-
-A13_FLAGS=-I${APACHE_HOME}/include
-
-## I assume this one is set up already
-# JAVA_HOME=
+JAVA_HOME=/usr/local/linux-jdk1.3.0

 JAVA_INCL=-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${OS}
 JAVA_LIB=-L${JAVA_HOME}/jre/lib/${ARCH}
-L${JAVA_HOME}/lib/${ARCH}/native_threads

-CFLAGS=-DHAVE_CONFIG_H -g -fpic  -DSHARED_MODULE -O2 -D_REENTRANT
-pthread -DLINUX -Wall
+CFLAGS=-DHAVE_CONFIG_H -g -fpic  -DSHARED_MODULE -O2 -pthread -DFREEBSD
-Wall

 JK=../jk/
 SRCS=jk_ajp12_worker.c jk_connect.c jk_msg_buff.c jk_util.c jk_ajp13.c \
@@ -23,10 +17,10 @@
 OBJS=${patsubst %.c,%.o,${SRCS}}

 %.o: ../jk/%.c
-       ${CC} -c ${CFLAGS} ${JAVA_INCL} ${A13_FLAGS} $< -o $@
+       ${CC} -c ${CFLAGS} ${JAVA_INCL} $< -o $@

 .c.o:
-       ${APXS} -c ${JAVA_INCL} -DFREEBSD ${A13_FLAGS} -I../jk $<
+       ${APXS} -c ${JAVA_INCL} -DFREEBSD -I../jk $<

 all: mod_jk.so

Hope this is helpful...

  - Tim

[-- Attachment #2 --]
# New ports collection makefile for:	jakarta-tomcat
# Date created:		23 Feb 2001
# Whom:			des
#
# $FreeBSD: $
#

PORTNAME=	jakarta-tomcat
PORTVERSION=	3.2.1
CATEGORIES=	www
MASTER_SITES=	http://jakarta.apache.org/builds/tomcat/release/v${PORTVERSION}/bin/
DISTNAME=	${PORTNAME}-${PORTVERSION}
DIST_SUBDIR=	jakarta/tomcat/${PORTVERSION}

MAINTAINER=	des@FreeBSD.org

BUILD_DEPENDS=	pinstall:${PORTSDIR}/devel/pinstall
#RUN_DEPENDS=	${LOCALBASE}/jdk1.1.8/bin/javac:${PORTSDIR}/java/jdk

NO_BUILD=	yes

do-install:
	@${LN} -fs ${WRKSRC} ${WRKDIR}/tomcat
	@pinstall -v -d ${WRKDIR}

.include <bsd.port.mk>

[-- Attachment #3 --]
MD5 (jakarta/tomcat/3.2.1/jakarta-tomcat-3.2.1.tar.gz) = 43178931ed737cfd92bdde22ed37c98c

[-- Attachment #4 --]
tomcat/LICENSE
tomcat/webapps/ROOT.war
tomcat/webapps/test.war
tomcat/webapps/examples.war
tomcat/webapps/admin.war
tomcat/conf/tomcat.policy
tomcat/conf/mod_jk.conf
tomcat/conf/wrapper.properties
tomcat/conf/web.xml
tomcat/conf/server.xml
tomcat/conf/manifest.servlet
tomcat/conf/tomcat.conf
tomcat/conf/tomcat.properties
tomcat/conf/test-tomcat.xml
tomcat/conf/uriworkermap.properties
tomcat/conf/workers.properties
tomcat/conf/obj.conf
tomcat/conf/jni_server.xml
tomcat/conf/jni_workers.properties
tomcat/conf/web.dtd
tomcat/conf/build.xml
tomcat/conf/tomcat-users.xml
tomcat/doc/appdev/processes.html
tomcat/doc/appdev/sample/build.sh
tomcat/doc/appdev/sample/build.bat
tomcat/doc/appdev/sample/web/index.html
tomcat/doc/appdev/sample/web/images/tomcat.gif
tomcat/doc/appdev/sample/web/hello.jsp
tomcat/doc/appdev/sample/src/Hello.java
tomcat/doc/appdev/sample/etc/web.xml
tomcat/doc/appdev/sample/build.xml
tomcat/doc/appdev/footer.html
tomcat/doc/appdev/source.html
tomcat/doc/appdev/installation.html
tomcat/doc/appdev/introduction.html
tomcat/doc/appdev/index.html
tomcat/doc/appdev/web.xml.txt
tomcat/doc/appdev/contents.html
tomcat/doc/appdev/build.xml.txt
tomcat/doc/appdev/tomcat.gif
tomcat/doc/appdev/deployment.html
tomcat/doc/appdev/header.html
tomcat/doc/JDBCRealm.howto
tomcat/doc/mod_jk-howto.html
tomcat/doc/uguide/images/banner.gif
tomcat/doc/uguide/images/tomcat.gif
tomcat/doc/uguide/tomcat_ug.html
tomcat/doc/uguide/style.css
tomcat/doc/uguide/tomcat-security.html
tomcat/doc/tomcat-ssl-howto.html
tomcat/doc/Tomcat-Workers-HowTo.html
tomcat/doc/index.html
tomcat/doc/in-process-howto.html
tomcat/doc/readme
tomcat/doc/tomcat-iis-howto.html
tomcat/doc/tomcat-netscape-howto.html
tomcat/doc/tomcat-apache-howto.html
tomcat/doc/faq
tomcat/doc/NT-Service-howto.html
tomcat/lib/test/Golden/image1.gif
tomcat/lib/test/Golden/HelloWorld.txt
tomcat/lib/test/Golden/implicitResponse.txt
tomcat/lib/test/Golden/implicitPageContext.txt
tomcat/lib/test/Golden/pageImport.txt
tomcat/lib/test/Golden/implicitOut.txt
tomcat/lib/test/Golden/ForwardWithQuery.txt
tomcat/lib/test/Golden/beanTest.txt
tomcat/lib/test/Golden/PrintWriterTest.txt
tomcat/lib/test/Golden/SimpleForward.txt
tomcat/lib/test/Golden/servletParam2.txt
tomcat/lib/test/Golden/Include.txt
tomcat/lib/test/Golden/movedwelcome.txt
tomcat/lib/test/Golden/movedindex.txt
tomcat/lib/test/Golden/implicitContext.txt
tomcat/lib/test/Golden/Mismatch2.txt
tomcat/lib/test/Golden/IncludeFile.txt
tomcat/lib/test/Golden/classTest.txt
tomcat/lib/test/Golden/import.txt
tomcat/lib/test/Golden/servletParam1.txt
tomcat/lib/test/Golden/ServletParam.txt
tomcat/lib/test/Golden/index.txt
tomcat/lib/test/Golden/implicitPage.txt
tomcat/lib/test/Golden/implicitException.txt
tomcat/lib/test/Golden/implicitConfig.txt
tomcat/lib/test/Golden/welcome.txt
tomcat/lib/test/Golden/implicitRequest.txt
tomcat/lib/test/Golden/implicitSession.txt
tomcat/lib/test/Golden/beanSer.txt
tomcat/lib/test/Golden/jsptoservlet.txt
tomcat/lib/test/Golden/Mismatch1.txt
tomcat/lib/test/Golden/MustFail.txt
tomcat/lib/test/Golden/buffer.txt
tomcat/lib/test/Golden/parse.txt
tomcat/lib/test/Golden/SimpleInclude.txt
tomcat/lib/test/Golden/Err.txt
tomcat/lib/ant.jar
tomcat/lib/jaxp.jar
tomcat/lib/servlet.jar
tomcat/lib/parser.jar
tomcat/lib/webserver.jar
tomcat/lib/jasper.jar
tomcat/bin/jspc.bat
tomcat/bin/cpappend.bat
tomcat/bin/antRun
tomcat/bin/antRun.bat
tomcat/bin/ant.bat
tomcat/bin/startup.sh
tomcat/bin/shutdown.sh
tomcat/bin/startup.bat
tomcat/bin/tomcat.bat
tomcat/bin/shutdown.bat
tomcat/bin/tomcat.sh
tomcat/bin/tomcatEnv.bat
tomcat/bin/ant
tomcat/bin/jspc.sh
@dirrm tomcat/webapps
@dirrm tomcat/conf
@dirrm tomcat/doc
@dirrm tomcat/doc/appdev
@dirrm tomcat/doc/appdev/sample
@dirrm tomcat/doc/appdev/sample/web
@dirrm tomcat/doc/appdev/sample/web/images
@dirrm tomcat/doc/appdev/sample/src
@dirrm tomcat/doc/appdev/sample/etc
@dirrm tomcat/doc/uguide
@dirrm tomcat/doc/uguide/images
@dirrm tomcat/lib
@dirrm tomcat/lib/test
@dirrm tomcat/lib/test/Golden
@dirrm tomcat/bin
@dirrm tomcat
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.30.0103081437590.15709-400000>