Mac OS X: Jakarta Tomcat install

    Mac OS X: Jakarta Tomcat install

    .

    Adding Java Server Pages and servlets to the Apache web server27 March 2001

    The Apache Group is providing a Java Server Pages (JSP) and servlet processing engine as an add-on to their epynomously named web server. These two technologies are key to providing dynamic web page content as well as allowing Java to create persistent server-side objects. (If you don’t know what this means then you don’t need the Tomcat engine. If you do, however, here are my Apache Tomcat installation instructions.

    There are other technologies which I’m still investigating. First and foremost are those which enable me to deploy Enterprise JavaBeans (EJB) on my site. (This will also require a relational database for persistent store. Several free databases are available, although at this point I don’t know what’s been integrated with EJB engines on Darwin (the FreeBSD-based operating system underneath the glitzy Aqua user interface of Mac OS X).

    This page describes the installation of the Apache Web Server and Apache Jakarta Tomcat JSP (Java Server Page) container. Rather than describing what you’re doing, I’ll show you exactly what to do. You’ll do the work of acquiring and installing software from within the Terminal application, using a web browser only for the testing steps.

    I assure you that the UNIX commands I’ll direct you to invoke have been taken directly from a Terminal window – these are the commands I just used to do a clean install – rather than having been composed after the fact. This is *exactly* what worked for me. I’ve taken pains to choose forms of the commands which should make sense to you even if you’re new to UNIX.

    Get and install the Apache web server

    Follow the instructions on

    and come back here. We’ll be waiting.

    Prepare your environment

    Using your favorite text editor (pico, vi, or emacs on the command-line side or SimpleText or BBEdit on the graphic user interface side) edit (or create and edit) a file named .tcshrc in your home directory. Edit this file and ncorporate the following:

    # General settings for compiling programs

    setenv CC cc

    setenv CPPFLAGS -traditional-cpp

    # Java on Mac OS X

    setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework

    # Apache Jakarta Tomcat

    setenv JAKARTA_HOME ~/Applications/java/jakarta

    setenv TOMCAT_HOME ${JAKARTA_HOME}/tomcat-3.2.1

    alias tcu sudo ${TOMCAT_HOME}/bin/startup.sh

    alias tcd sudo ${TOMCAT_HOME}/bin/shutdown.sh

    If you are less lazy than I am, and you don’t want shortcuts to the commands to manage Tomcat, then you could omit the lines beginning with ‘alias’. The shortcuts are of the form (program)+(state), so ‘tcu’ means “Tomcat up”. These are my personal conventions, rather than something industry wide, so feel free to change them to fit your mood. and whim.

    Save the file, return to the Terminal, and set your environment with the settings we just created.

    % chmod 775 ~/.tcshrc

    % source ~/.tcshrc

    Create a place in which to work

    We’ll be downloading software from the Internet; here’s how we create a workspace for ourselves.

    % mkdir ~/install ; cd ~/install

    Get and install the Apache Jakarta Tomcat JSP container

    % cd ~/install

    % wget http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/jakarta-tomcat-3.2.1.tar.gz

    % mkdir -p $TOMCAT_HOME

    % cd $TOMCAT_HOME

    % pwd

    /Users/mickey/Applications/java/jakarta/tomcat-3.2.1

    % cd ..

    % rm -r tomcat-3.2.1/

    % cp ~/install/jakarta-tomcat-3.2.1.tar.gz .

    % gnutar zxf jakarta-tomcat-3.2.1.tar.gz

    % mv jakarta-tomcat-3.2.1 tomcat-3.2.1

    Start and test Tomcat

    % cd $TOMCAT_HOME

    % sudo ${TOMCAT_HOME}/bin/startup.sh

    Using classpath: [elided]

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /examples )

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /admin )

    Starting tomcat. Check logs/tomcat.log for error messages

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx(

    )

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /test )

    2001-05-22 11:08:01 – PoolTcpConnector: Starting HttpConnectionHandler on 8080

    2001-05-22 11:08:01 – PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

    %

    When you point your web browser to

    you should see the Tomcat main page (shown at right). f t

    To ensure that your installation succeeded follow the JSP and servlet links and select an example or two to see that both servlets and Java Server Pages are processed and rendered. This is using Tomcat as a “standalone container”, which may be enough if all you need is the ability to run servlets for development purposes.

    If you want the Apache web server and Tomcat to coöperate, with Apache serving static files (at which it excels) and Tomcat serving dynamic content (its job) then continue on with these installation instructions.

    Build mod_jk.so so Tomcat and Apache can communicate

    % cd ~/install

    % wget http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/src/jakarta-tomcat-3.2.1-src.tar.gz

    % wget http://download.sourceforge.net/fink/dlcompat-20010123.tar.gz

    % gnutar zxf dlcompat-20010123.tar.gz

    % gnutar zxf jakarta-tomcat-3.2.1-src.tar.gz

    % setenv MOD_JK_DIR jakarta-tomcat-3.2.1-src/src/native/apache1.3/

    % cp dlcompat-20010123/{dlfcn.h,dlopen.c} $MOD_JK_DIR

    % cd $MOD_JK_DIR

    % apxs -o mod_jk.so -I. -I$JAVA_HOME/Headers -I../jk -DFREEBSD -c *.c ../jk/*.c

    % sudo chmod ugo+x mod_jk.so

    % sudo cp *.so /usr/libexec/httpd

    % sudo ln -sf /usr/libexec/httpd/mod_jk.so /usr/libexec/mod_jk.so

    Add a connector so Tomcat and Apache can communicate

    % cd $TOMCAT_HOME/conf

    Using your favorite text editor open the file server.xml and locate the following paragraph:

    and add the following paragraph:

    Start and test the Apache-Tomcat coöperation

    % sudo ${TOMCAT_HOME}/bin/shutdown.sh

    % sudo ${TOMCAT_HOME}/bin/startup.sh

    Using classpath: [elided]

    2001-05-22 12:08:24 – PoolTcpConnector: Starting Ajp13ConnectionHandler on 8009

    % sudo apachectl restart

    Pointing your web browser to

    should result in the. You should see a directory listing for the Tomcat directory (as shown at right) with links to JSP and Servlet example directories. Following the links should bring you to the web pages you saw when testing Tomcat as a standalone container.

    If it doesn’t you might want to check that Apache is reading in the mod_jk information. On my installation it had been placed in the configuration file but had somehow been commented out (that is to say the line was preceeded by a ‘#’, rendering it nonoperative). The following shows the line as it should be (of course, unless your username is mickey your path will be different 🙂

    % grep mod_jk /private/etc/httpd/httpd.conf

    Include /Users/mickey/Applications/java/jakarta/tomcat-3.2.1/conf/mod_jk.conf-auto

    %

    Clean up after yourself

    % rm -rf ~/install

    %

    You might want to – okay, you really ought to – jump up one level, to see how this fits into the

    of developing and deploying web-based applications (and to see what other tools I’ve installed to work with this one).

    This page

    is

    1993-2006 by ,

    via the Creative Commons License. Questions and comments? Send

    to the Geek Times Webmaster. (Domain and web content hosting at .)

    Leave a Reply

    Your email address will not be published.

    Mac OS X: Jakarta Tomcat install

    Mac OS X: Jakarta Tomcat install

    .

    Adding Java Server Pages and servlets to the Apache web server27 March 2001

    The Apache Group is providing a Java Server Pages (JSP) and servlet processing engine as an add-on to their epynomously named web server. These two technologies are key to providing dynamic web page content as well as allowing Java to create persistent server-side objects. (If you don’t know what this means then you don’t need the Tomcat engine. If you do, however, here are my Apache Tomcat installation instructions.

    There are other technologies which I’m still investigating. First and foremost are those which enable me to deploy Enterprise JavaBeans (EJB) on my site. (This will also require a relational database for persistent store. Several free databases are available, although at this point I don’t know what’s been integrated with EJB engines on Darwin (the FreeBSD-based operating system underneath the glitzy Aqua user interface of Mac OS X).

    This page describes the installation of the Apache Web Server and Apache Jakarta Tomcat JSP (Java Server Page) container. Rather than describing what you’re doing, I’ll show you exactly what to do. You’ll do the work of acquiring and installing software from within the Terminal application, using a web browser only for the testing steps.

    I assure you that the UNIX commands I’ll direct you to invoke have been taken directly from a Terminal window – these are the commands I just used to do a clean install – rather than having been composed after the fact. This is *exactly* what worked for me. I’ve taken pains to choose forms of the commands which should make sense to you even if you’re new to UNIX.

    Get and install the Apache web server

    Follow the instructions on

    and come back here. We’ll be waiting.

    Prepare your environment

    Using your favorite text editor (pico, vi, or emacs on the command-line side or SimpleText or BBEdit on the graphic user interface side) edit (or create and edit) a file named .tcshrc in your home directory. Edit this file and ncorporate the following:

    # General settings for compiling programs

    setenv CC cc

    setenv CPPFLAGS -traditional-cpp

    # Java on Mac OS X

    setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework

    # Apache Jakarta Tomcat

    setenv JAKARTA_HOME ~/Applications/java/jakarta

    setenv TOMCAT_HOME ${JAKARTA_HOME}/tomcat-3.2.1

    alias tcu sudo ${TOMCAT_HOME}/bin/startup.sh

    alias tcd sudo ${TOMCAT_HOME}/bin/shutdown.sh

    If you are less lazy than I am, and you don’t want shortcuts to the commands to manage Tomcat, then you could omit the lines beginning with ‘alias’. The shortcuts are of the form (program)+(state), so ‘tcu’ means “Tomcat up”. These are my personal conventions, rather than something industry wide, so feel free to change them to fit your mood. and whim.

    Save the file, return to the Terminal, and set your environment with the settings we just created.

    % chmod 775 ~/.tcshrc

    % source ~/.tcshrc

    Create a place in which to work

    We’ll be downloading software from the Internet; here’s how we create a workspace for ourselves.

    % mkdir ~/install ; cd ~/install

    Get and install the Apache Jakarta Tomcat JSP container

    % cd ~/install

    % wget http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin/jakarta-tomcat-3.2.1.tar.gz

    % mkdir -p $TOMCAT_HOME

    % cd $TOMCAT_HOME

    % pwd

    /Users/mickey/Applications/java/jakarta/tomcat-3.2.1

    % cd ..

    % rm -r tomcat-3.2.1/

    % cp ~/install/jakarta-tomcat-3.2.1.tar.gz .

    % gnutar zxf jakarta-tomcat-3.2.1.tar.gz

    % mv jakarta-tomcat-3.2.1 tomcat-3.2.1

    Start and test Tomcat

    % cd $TOMCAT_HOME

    % sudo ${TOMCAT_HOME}/bin/startup.sh

    Using classpath: [elided]

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /examples )

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /admin )

    Starting tomcat. Check logs/tomcat.log for error messages

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx(

    )

    2001-05-22 11:08:00 – ContextManager: Adding context Ctx( /test )

    2001-05-22 11:08:01 – PoolTcpConnector: Starting HttpConnectionHandler on 8080

    2001-05-22 11:08:01 – PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

    %

    When you point your web browser to

    you should see the Tomcat main page (shown at right). f t

    To ensure that your installation succeeded follow the JSP and servlet links and select an example or two to see that both servlets and Java Server Pages are processed and rendered. This is using Tomcat as a “standalone container”, which may be enough if all you need is the ability to run servlets for development purposes.

    If you want the Apache web server and Tomcat to coöperate, with Apache serving static files (at which it excels) and Tomcat serving dynamic content (its job) then continue on with these installation instructions.

    Build mod_jk.so so Tomcat and Apache can communicate

    % cd ~/install

    % wget http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/src/jakarta-tomcat-3.2.1-src.tar.gz

    % wget http://download.sourceforge.net/fink/dlcompat-20010123.tar.gz

    % gnutar zxf dlcompat-20010123.tar.gz

    % gnutar zxf jakarta-tomcat-3.2.1-src.tar.gz

    % setenv MOD_JK_DIR jakarta-tomcat-3.2.1-src/src/native/apache1.3/

    % cp dlcompat-20010123/{dlfcn.h,dlopen.c} $MOD_JK_DIR

    % cd $MOD_JK_DIR

    % apxs -o mod_jk.so -I. -I$JAVA_HOME/Headers -I../jk -DFREEBSD -c *.c ../jk/*.c

    % sudo chmod ugo+x mod_jk.so

    % sudo cp *.so /usr/libexec/httpd

    % sudo ln -sf /usr/libexec/httpd/mod_jk.so /usr/libexec/mod_jk.so

    Add a connector so Tomcat and Apache can communicate

    % cd $TOMCAT_HOME/conf

    Using your favorite text editor open the file server.xml and locate the following paragraph:

    and add the following paragraph:

    Start and test the Apache-Tomcat coöperation

    % sudo ${TOMCAT_HOME}/bin/shutdown.sh

    % sudo ${TOMCAT_HOME}/bin/startup.sh

    Using classpath: [elided]

    2001-05-22 12:08:24 – PoolTcpConnector: Starting Ajp13ConnectionHandler on 8009

    % sudo apachectl restart

    Pointing your web browser to

    should result in the. You should see a directory listing for the Tomcat directory (as shown at right) with links to JSP and Servlet example directories. Following the links should bring you to the web pages you saw when testing Tomcat as a standalone container.

    If it doesn’t you might want to check that Apache is reading in the mod_jk information. On my installation it had been placed in the configuration file but had somehow been commented out (that is to say the line was preceeded by a ‘#’, rendering it nonoperative). The following shows the line as it should be (of course, unless your username is mickey your path will be different 🙂

    % grep mod_jk /private/etc/httpd/httpd.conf

    Include /Users/mickey/Applications/java/jakarta/tomcat-3.2.1/conf/mod_jk.conf-auto

    %

    Clean up after yourself

    % rm -rf ~/install

    %

    You might want to – okay, you really ought to – jump up one level, to see how this fits into the

    of developing and deploying web-based applications (and to see what other tools I’ve installed to work with this one).

    This page

    is

    1993-2006 by ,

    via the Creative Commons License. Questions and comments? Send

    to the Geek Times Webmaster. (Domain and web content hosting at .)

    Leave a Reply

    Your email address will not be published.