http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Index
License

Install
Install on Solaris8
Install on Win2k

Technologies
Infrastructure
User Guide
Dynamic Content
How it works

XSP Processor
SQL XSP Taglib
FP XSP Taglib
SQL Conn Pool
SQL Processor
LDAP Processor
DCP Processor

XSP WD

Javadocs

Cocoon 2

FAQ
Changes
Todo

Live Sites

Code Repository
Dev Snapshots
Mail Lists
Mail Archive


Introduction - Cocoon Installation Case (Solaris 8)

I have successfully been able to get Cocoon V1.7.4 to work with the following combination of software :

  • Jakarta-Tomcat V3.1
  • Apache HTTP Server V1.3.12
  • Sun Java SDK SE V1.3 Beta Refresh
  • Solaris 8 (SPARC)
  • Netscape Navigator V4.7

The additional tools listed below are required to perform this installation :

  • gcc V2.95.2
  • make V3.79
  • perl V5.005_03
  • Jakarta-Ant V1.0.8 - 2000/03/04
  • Jakarta-Tools

What follows is some step by step info on how I got it all working. I am submitting this for two reasons: one, as a reference for me for installations on other machines at a later date and two, to provide some help to poor (hardware) engineers like myself who expect install instructions to include every step to actually get the product working !!

Hope this is useful to someone.


How to do it !

I followed the standard Cocoon install instructions but without success. (Most of it is there but it could be a bit clearer.)

I have listed below the key steps that actually got the combination shown above to work.

I have included sections on installing Java SDK, Apache and Jakarta-Tomcat to avoid any possible ambiguity. So, there may be more detail than is actually required - but why not - as long as it all works in the end !

The relevant sections of the modified files mentioned have been partially listed.

The steps listed below mention my own machine name and my own specific paths. Substitute your own naturally. I thought it was better to leave them in to avoid the "path to your..." directives which can sometimes be ambiguous when it comes to how paths are specified within the Windows and Solaris environments i.e forward ("/") and backward slashes ("\") etc ..

Note Warning : This is long and verbose ! The steps and file listings should be read in the order given i.e top down to bottom.

Note Before I started this setup on my machine, I did not have any pre-existing Jakarta-Tomcat, Cocoon, or even anything in the CLASSPATH env variable. It was a completely new install on a fresh Solaris 8 SPARC machine.

OK lets go....


Java SDK SE V1.3 Beta Refresh
  • A typical Solaris 8 install will install Java 1.1 and Java 1.2 by default in the /usr/java1.1 and /usr/java1.2 directories. I, however, still chose to install the latest Java SDK which was "V1.3 Beta Refresh" at the time of writing.
  • Install Sun Java SDK SE V1.3 Beta Refresh via the standard install procedure i.e unpack the archive or pkgadd the downloaded distribution. Install any required patches.
  • I chose to install at path /usr/local/j2sdk1_3_0beta_refresh. Installing Java at this location avoids disturbing the existing Java 1.1 and 1.2 environments mentioned above.
  • No worries !

Apache V1.3.12 HTTP Server
  • A typical Solaris 8 install will install Apache V1.3.9 by default in the /usr/apache and /etc/apache directories. You may also find other Apache installations to support Sun's SunSolve CD or Sun's StorEdge LibMON programs. I, however, still chose to install the latest Apache HTTP server which was "V1.3.12" at the time of writing.
  • Download the SOURCE for Apache V1.3.12 from the Apache web site - http://www.apache.org/dist/apache_1.3.12.tar.gz and unpack it in an area where it can be compiled from e.g /work/test/apache.
  • Note: I initially downloaded a pre-compiled binary of Apache for Solaris 8 but it did not have shared module (DSO) support enabled when it was compiled, which meant mod_jserv.so (needed for the Apache - Jakarta-Tomcat combination) could not be built (see Jakarta-Tomcat section for more details).
  • So, I had to compile Apache. This meant I needed a C compiler and Perl.
  • Perl (V5.005_003) came with Solaris 8 as standard - /bin/perl.
  • I downloaded a pre-compiled version of GNU gcc V2.95.2 for Solaris 8 from the web - ftp://nce.sun.ca/pub/freeware/sparc/8/gcc-2.95.2-sol8-sparc-local.gz.
  • OK, to compile Apache with DSO support I used the following commands:
  • cd /work/test/apache
  • ./configure --prefix=/usr/local/apache --enable-module=all --enable-shared=max --disable-module=auth_db
  • make
  • make install
  • This will compile Apache and install it in /usr/local/apache.
  • Now, in order to build mod_jserv.so there is still one more Apache related step, which is to modify file /usr/local/apache/bin/apxs. Modify the two lines as shown in the code segment below.
  • If this is not done then the linker (ld) command is not found and dynamic shared objects (-G) are not produced. This is important!
  • I won't tell you how long it took me to work this out!
  • Modify the /usr/local/apache/conf/httpd.conf file to include your machine DNS name and that port 80 is assigned to this HTTP server. See code segment below.
  • Note: As was mentioned before, your system may already have a number of http servers running. This is OK as long as there isn't a port clash. Ensure other httpd servers are not also using port 80.
  • Ensure Apache is actually working by starting it with - /usr/local/apache/bin/httpd -d /usr/local/apache
  • Try and access http://shaggy.blimp.au. You should get the standard "If you can see this, it means that the installation of the Apache web server software on this system was successful" page.
  • No worries!

/usr/local/apache/bin/apxs

     ....................
     my $CFG_LD_SHLIB      = q(ld);    # substituted via Makefile.tmpl
     my $CFG_LDFLAGS_SHLIB = q(-G);    # substituted via Makefile.tmpl  
     ....................
    

/usr/local/apache/conf/httpd.conf

     ....................
     #
     # ServerName allows you to set a host name which is sent back to clients for
     # your server if it's different than the one the program would get (i.e., use
     # "www" instead of the host's real name).
     #
     # Note: You cannot just invent host names and hope they work. The name you 
     # define here must be a valid DNS name for your host. If you don't understand
     # this, ask your network administrator.
     # If your host doesn't have a registered DNS name, enter its IP address here.
     # You will have to access it by its address (e.g., http://123.45.67.89/)
     # anyway, and this will make redirections work in a sensible way.
     #
     ServerName shaggy.blimp.au
     ....................
     #
     # Port: The port to which the standalone server listens. For
     # ports < 1023, you will need httpd to be run as root initially.
     #
     Port 80
     ....................
     

Jakarta-Tomcat V3.1
  • Download the BINARY and SOURCE distributions of Jakarta-Tomcat from the Jakarta web site.
  • Note: Although the BINARY download of Jakarta-Tomcat has a SRC directory it does not contain ALL of the source files i.e the "native" directory is missing.
  • You MUST download the SOURCE distribution for Jakarta-Tomcat as a very minimum in order to build mod_jserv.so.
  • I did not have to actually compile Jakarta-Tomcat itself since the .jar files contained within the BINARY Jakarta-Tomcat distribution work OK. So, I unpacked the BINARY Jakarta-Tomcat distribution into directory /usr/local/jakarta-tomcat.
  • But, since I had the Jakarta-Tomcat source, I had a go at building it anyway. This worked OK but I had to download the BINARY distributions of Jakarta-Ant and Jakarta-Tools. (You may now realise why I said to download both the BINARY and SOURCE distributions of Jakarta-Tomcat since with the BINARY distribution of Jakarta-Tomcat you don't have to worry about getting Jakarta-Ant and Jakarta-Tools since you don't need to compile Jakarta-Tomcat unless you are doing something special with it.)
  • The BINARY distributions for Jakarta-Ant and Jakarta-Tools can be found on the BINARY download page for Jakarta-Tomcat. (Note: You cannot use the latest Jakarta-Ant V1.1 from its download page. Only use the Jakarta-Ant/Jakarta-Tools that can be downloaded on the very SAME download page as Jakarta-Tomcat.)
  • OK, lets build mod_jserv.so
  • Unpack the SOURCE distribution of Jakarta-Tomcat in a directory where you can compile from e.g /work/test/jakarta-tomcat. Now, cd into the /work/test/jakarta-tomcat/src/native/apache/jserv directory.
  • Execute : /usr/local/apache/bin/apxs -c *.c
  • Execute : cp autochange.so /usr/local/apache/libexec/mod_jserv.so. (Yea, I know it looks strange but just do it !)
  • Add the following line "include /usr/local/jakarta-tomcat/conf/tomcat-apache.conf" to the Apache configuration file /usr/local/apache/conf/httpd.conf. See code segment below.
  • File /usr/local/jakarta-tomcat/conf/tomcat-apache.conf contains the reference to mod_jserv.so.
  • Obviously, you can see that I unpacked all of the BINARY Jakarta-Tomcat distribution into /usr/local/jakarta-tomcat. i.e I did not actually compile Jakarta-Tomcat.
  • Now, if you want or need to actually compile Jakarta-Tomcat then this is how I did it.
  • Assuming the SOURCE distribution of Jakarta-Tomcat has been unpacked.
  • Unpack the BINARY distribution of Jakarta-Ant.
  • Unpack the BINARY distribution of Jakarta-Tools.
  • My directory structure for building was : /work/test/jakarta-tomcat, /work/test/jakarta-tools, /work/test/jakarta-ant
  • Add the line "JAVA_HOME=/usr/local/j2sdk1_3_0beta_refresh" to your Jakarta-Tomcat /work/test/jakarta-tomcat/build.sh file. See code segment below.
  • Execute : /work/test/jakarta-tomcat/build.sh dist
  • This will build ALL the files needed for Jakarta-Tomcat
  • After executing Jakarta-Tomcat's build.sh program the resultant binary distribution is put in directory : /work/dist
  • To use your newly compiled Jakarta-Tomcat distribution you can copy this to your Jakarta-Tomcat executing directory (in my case /usr/local/jakarta-tomcat). (I didn't need to build Jakarta-Tomcat, so I'd already filled /usr/local/jakarta-tomcat with the unpacked BINARY distribution of Jakarta-Tomcat.)
  • Modify /usr/local/jakarta-tomcat/bin/tomcat.sh to add env variables TOMCAT_HOME and JAVA_HOME. See code segment below.
  • Kill Apache - Execute : kill -TERM `cat /usr/local/apache/logs/httpd.pid`
  • Start Jakarta-Tomcat - Execute : /usr/local/jakarta-tomcat/tomcat.sh start
  • Start Apache - Execute : /usr/local/apache/bin/httpd -d /usr/local/apache
  • Start Netscape.
  • Try and access the Jakarta-Tomcat JSP test page http://shaggy.blimp.au:8080/examples/jsp/ - Note the 8080 port in the address.
  • Click on any of the JSP examples to test.
  • Try and access the Jakarta-Tomcat Servlet test page http://shaggy.blimp.au:8080/examples/servlets/ - Note the 8080 port in the address.
  • Click on any of the servlet examples to test.
  • Note: You don't have to copy the Jakarta-Tomcat /usr/local/jakarta-tomcat/webapps/examples directory to the Apache /usr/local/apache/htdocs directory. Due to the 8080 port in the web addresses shown above, the files in directory /usr/local/jakarta-tomcat/webapps/examples are actually referenced automatically by Jakarta-Tomcat.
  • No worries !

/usr/local/apache/conf/httpd.conf

     ...........
     #
     # VirtualHost example:
     # Almost any Apache directive may go into a VirtualHost container.
     #
     #<VirtualHost ip.address.of.host.some_domain.com>
     #    ServerAdmin webmaster@host.some_domain.com
     #    DocumentRoot /www/docs/host.some_domain.com
     #    ServerName host.some_domain.com
     #    ErrorLog logs/host.some_domain.com-error_log
     #    CustomLog logs/host.some_domain.com-access_log common
     #</VirtualHost>
     
     #<VirtualHost _default_:*>
     #</VirtualHost>
     
     include /usr/local/jakarta-tomcat/conf/tomcat-apache.conf
 
    

/work/test/jakarta-tomcat/build.sh


     #! /bin/sh

     JAVA_HOME=/usr/local/j2sdk1_3_0beta_refresh 
     
     if [ -z "$JAVA_HOME" ]
     then
     JAVACMD=`which java`
     if [ -z "$JAVACMD" ]
     then
     echo "Cannot find JAVA. Please set your PATH."
     exit 1
     fi
     JAVA_BINDIR=`dirname $JAVACMD`
     JAVA_HOME=$JAVA_BINDIR/..
     fi
     
     JAVACMD=$JAVA_HOME/bin/java
     
     cp=../jakarta-ant/lib/ant.jar:\
     ../jakarta-tools/moo.jar:\
     ../jakarta-ant/lib/xml.jar:\
     ../build/tomcat/classes:\
     $JAVA_HOME/lib/tools.jar:\
     $JAVA_HOME/lib/dev.jar
     
     $JAVACMD -classpath $cp:$CLASSPATH org.apache.tools.ant.Main "$@"

    

/usr/local/jakarta-tomcat/bin/tomcat.sh

     #!/bin/sh
     #
     
     # Shell script to start and stop the server
     
     # There are other, simpler commands to startup the runner. The two
     # commented commands good replacements. The first works well with
     # Java Platform 1.1 based runtimes. The second works well with
     # Java2 Platform based runtimes.
     
     TOMCAT_HOME=/usr/local/jakarta-tomcat
     
     JAVA_HOME=/usr/local/j2sdk1_3_0beta_refresh

     .........
    

Cocoon V1.7.4
  • I chose to install (i.e unpack the zip) at path /usr/local/cocoon-1.7.4 (Actually the important files in the Cocoon distribution all end up being copied into the working Jakarta-Tomcat directories, so the unpacked Cocoon can be either deleted or left where it is after the files have been copied.)
  • Copy the xerces_1_0_3.jar, xalan_1_0_1.jar, fop_0_12_1.jar and servlet_2_2.jar files, found in the /usr/local/cocoon-1.7.4/lib to the /usr/local/jakarta-tomcat/lib directory.
  • Copy the /usr/local/cocoon-1.7.4/bin/cocoon.jar file to the /usr/local/jakarta-tomcat/lib directory.
  • Modify /usr/local/jakarta-tomcat/bin/tomcat.sh to add the five Cocoon .jar files to the Jakarta-Tomcat CLASSPATH env variable. See code segment below.
  • Note the commented out "#CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/servlet.jar" line.
  • Modify the /usr/local/jakarta-tomcat/conf/web.xml file to add the Cocoon specific configuration directives. See code segment below.
  • And now for the really really important step, copy the /usr/local/cocoon-1.7.4/conf/cocoon.properties file to the /usr/local/jakarta-tomcat/webapps/ROOT directory.
  • Now, if everything has been performed as specified above and if the gods are smiling on you today, then (and you'll hate me if it doesn't) it should all work now.
  • OK. To test it all, do the following :
  • If Jakarta-Tomcat is still running, then kill it by typing : /usr/local/jakarta-tomcat/bin/tomcat.sh stop
  • If Apache is still running, then kill it by typing : kill -TERM `cat /usr/local/apache/logs/httpd.pid`
  • Now, start up Jakarta-Tomcat as detailed in the Jakarta-Tomcat V3.1 section shown above.
  • Now, start up Apache as detailed in the Apache V1.3.12 HTTP Server section shown above.
  • Start Netscape.
  • The big test - try and access http://shaggy.blimp.au:8080/Cocoon.xml - You should see the Cocoon V1.7.4 status page containing all of the internal configuration information and settings specific to Cocoon. Note the 8080 port number.
  • Note the uppercase "C" in Cocoon.xml. Also, you won't find this file on the hard disk, it is an internal page and its name is set in the cocoon.properties file.
  • OK, if the internal Cocoon status page is working then you can try and access the Cocoon examples as follows :
  • Copy the /usr/local/cocoon-1.7.4/samples directory to the /usr/local/jakarta-tomcat/webapps directory.
  • Copy the cocoon.properties file to the new /usr/local/jakarta-tomcat/webapps/samples directory - again this is a really important step.
  • Kill Jakarta-Tomcat.
  • Kill Apache.
  • Restart Jakarta-Tomcat.
  • Restart Apache.
  • Try and access http://shaggy.blimp.au:8080/samples/index.xml. Note the 8080 port number.
  • You should see the Cocoon samples page.
  • Thats it.
  • Again, note that no files were copied into the /usr/local/apache/htdocs directory. The Cocoon samples are found via Jakarta-Tomcat and port 8080.
  • One last thing to try. Create a directory called /usr/local/jakarta-tomcat/webapps/gogo.
  • Copy the Cocoon hello-page.xml and hello-page-html.xsl files found in the /usr/local/cocoon-1.7.4/samples/hello directory into the new gogo directory.
  • And again the really important step, copy the cocoon.properties file into the new gogo directory.
  • Kill Jakarta-Tomcat.
  • Kill Apache.
  • Restart Jakarta-Tomcat.
  • Restart Apache.
  • Start Netscape.
  • Try and access http://shaggy.blimp.au:8080/gogo/hello.xml.
  • You should see the Hello Page.
  • The purpose of the last few steps was to show how a new auto context can be setup in the Jakarta-Tomcat webapps directory. As I see it, put your own custom XML/XSL files in a directory that lives within the Jakarta-Tomcat /usr/local/jakarta-tomcat/webapps directory. Make sure cocoon.properites is also in there.
  • You could also put your custom XML/XSL work into just the Jakarta-Tomcat /usr/local/jakarta-tomcat/webapps/ROOT directory and as long as cocoon.properties is also in there (which it should be or else you won't be able to see the internal Cocoon.xml status page) then it should all work from that ROOT directory.
  • In order to avoid Jakarta-Tomcat having to serve up everything on port 8080, the /usr/local/jakarta-tomcat/conf/tomcat-apache.conf file can be modified by adding the line "AddHandler jserv-servlet .xml". (Refer to the start of the listing for /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf below to see where the line should be.)
  • After starting/stopping Jakarta-Tomcat and Apache in the same manner as described above you should now be able to access XML files without specifying port 8080. e.g http://shaggy.blimp.au/samples/index.xml. Note : If your browser cannot find the file then make sure your /usr/local/jakarta-tomcat/conf/server.xml file has alias directives for the samples directory or follow the procedure in the next few steps.
  • Note : You must be careful when making modifications to /usr/local/jakarta-tomcat/conf/tomcat-apache.conf because this file is automatically generated each time Jakarta-Tomcat starts and will therefore overwrite any modifications you have made. To complicate matters, the contents of /usr/local/jakarta-tomcat/conf/server.xml, where you might specify some context "AutoSetup actions", determines some of the content of /usr/local/jakarta-tomcat/conf/tomcat-apache.conf, so simply making a once off copy of /usr/local/jakarta-tomcat/conf/tomcat-apache.conf and adding the "AddHandler jserv-servlet .xml" line and referencing the copied .conf file with the include statement in /usr/local/Apache Group/Apache/conf/httpd.conf may also lead to problems.
  • My solution was to eliminate all context AutoSetup actions in /usr/local/jakarta-tomcat/conf/server.xml, then copy a freshly generated version of /usr/local/jakarta-tomcat/conf/tomcat-apache.conf to /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf, then add the line "AddHandler jserv-servlet .xml" to /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf, then modify the include statement in /usr/local/apache/conf/httpd.conf to read "include /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf". This method places the onus on the webmaster to make sure the copied and modified version of /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf is always up to date. See code segment below.
  • I have listed my much simplified /usr/local/jakarta-tomcat/conf/server.xml file. Note the references to my test gogo directory in file /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf which are needed in order to get the hello-page.xml example working without using port 8080 in the address. See code segment below.
  • Well, thats how I got it to work.
  • Works for me and I hope for you too.
  • Sorry for all the completely specified file and directory paths, but it should at least be unambiguous. No worries !

/usr/local/jakarta-tomcat/bin/tomcat.sh

     .................
     CLASSPATH=$TOMCAT_HOME/classes

     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xerces_1_0_3.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xalan_1_0_1.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/fop_0_12_1.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/servlet_2_2.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/cocoon.jar
     
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/webserver.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/jasper.jar
     CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xml.jar
     #CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/servlet.jar
     CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar

     .................
    

/usr/local/jakarta-tomcat/conf/web.xml

     <?xml version="1.0" encoding="ISO-8859-1"?>
     
     <!DOCTYPE web-app
         PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
         "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
     
     <web-app>
         <servlet>
             <servlet-name>
                 default
             </servlet-name>
             <servlet-class>
                 org.apache.tomcat.servlets.DefaultServlet
             </servlet-class>
     	<load-on-startup>
                 -2147483646
     	</load-on-startup>
         </servlet>
         <servlet>
             <servlet-name>
                 invoker
             </servlet-name>
     <!--
                 org.apache.tomcat.servlets.NoInvokerServlet
     -->
             <servlet-class>
                 org.apache.tomcat.servlets.InvokerServlet
             </servlet-class>
         </servlet>
         <servlet>
             <servlet-name>
                 jsp
             </servlet-name>
             <servlet-class>
                 org.apache.jasper.runtime.JspServlet
             </servlet-class>
     
     <!-- uncomment the following to use Jikes for JSP compilation
     
             <init-param>
                 <param-name>jspCompilerPlugin</param-name>
                 <param-value>org.apache.jasper.compiler.JikesJavaCompiler</param-value>
             </init-param>
     
     -->
     
     	<load-on-startup>
                 -2147483646
     	</load-on-startup>
         </servlet>
         <servlet-mapping>
             <servlet-name>
                 invoker
             </servlet-name>
             <url-pattern>
                 /servlet/*
             </url-pattern>
         </servlet-mapping>
         <servlet-mapping>
             <servlet-name>
                 jsp
             </servlet-name>
             <url-pattern>
                 *.jsp
             </url-pattern>
         </servlet-mapping>
         <session-config>
             <session-timeout>
                 30
             </session-timeout>
         </session-config>
     

<!-- Start Cocoon Section -->

         <servlet>
          <servlet-name>org.apache.cocoon.Cocoon</servlet-name>
          <servlet-class>org.apache.cocoon.Cocoon</servlet-class>
          <init-param>
           <param-name>properties</param-name>
           <param-value>
            cocoon.properties 
           </param-value>
          </init-param>
         </servlet>
         
         
         <servlet-mapping>
          <servlet-name>org.apache.cocoon.Cocoon</servlet-name>
          <url-pattern>*.xml</url-pattern>
         </servlet-mapping>

<!-- End Cocoon Section -->

     
         <mime-mapping>
             <extension>
                 txt
             </extension>
             <mime-type>
                 text/plain
             </mime-type>
         </mime-mapping>
     
     ..........
     
    

/usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf

      LoadModule jserv_module libexec/mod_jserv.so
      ApJServManual on
      ApJServDefaultProtocol ajpv12
      ApJServSecretKey DISABLED
      ApJServMountCopy on
      ApJServLogLevel notice
      
      ApJServDefaultPort 8007
      
      AddHandler jserv-servlet .xml
      
      AddType test/jsp .jsp
      AddHandler jserv-servlet .jsp
      Alias /examples /usr/local/jakarta-tomcat/webapps/examples
      <Directory "/usr/local/jakarta-tomcat/webapps/examples">
          Options Indexes FollowSymLinks
      </Directory>
      ApJServMount /examples/servlet /examples
      <Location /examples/WEB-INF/ >
          AllowOverride None
          deny from all
      </Location>
      
      Alias /test /usr/local/jakarta-tomcat/webapps/test
      <Directory "/usr/local/jakarta-tomcat/webapps/test">
          Options Indexes FollowSymLinks
      </Directory>
      ApJServMount /test/servlet /test
      <Location /test/WEB-INF/ >
          AllowOverride None
          deny from all
      </Location>
      
      Alias /admin /usr/local/jakarta-tomcat/webapps/admin
      <Directory "/usr/local/jakarta-tomcat/webapps/admin">
          Options Indexes FollowSymLinks
      </Directory>
      ApJServMount /admin/servlet /admin
      <Location /admin/WEB-INF/ >
          AllowOverride None
          deny from all
      </Location>
      
      Alias /samples /usr/local/jakarta-tomcat/webapps/samples
      <Directory "/usr/local/jakarta-tomcat/webapps/samples">
          Options Indexes FollowSymLinks
      </Directory>
      ApJServMount /samples/servlet /samples
      <Location /samples/WEB-INF/ >
          AllowOverride None
          deny from all
      </Location>
      
      Alias /gogo /usr/local/jakarta-tomcat/webapps/gogo
      <Directory "/usr/local/jakarta-tomcat/webapps/gogo">
          Options Indexes FollowSymLinks
      </Directory>
      ApJServMount /gogo/servlet /gogo
      <Location /gogo/WEB-INF/ >
          AllowOverride None
          deny from all
      </Location>
      
      ApJServMount /servlet /ROOT
 
    

/usr/local/jakarta-tomcat/conf/server.xml

      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      <Server>
          <!-- Debug low-level events in XmlMapper startup -->
          <xmlmapper:debug level="0" />
      
          <!-- This is quite flexible; we can either have a log file per
               module in Tomcat (example: ContextManager) or we can have
               one for Servlets and one for Jasper, or we can just have
      	 one tomcat.log for both Servlet and Jasper.
      
      	 If you omit "path" there, then stderr should be used.
      
      	 verbosityLevel values can be: 
      	    FATAL
      	    ERROR
      	    WARNING 
                  INFORMATION
                  DEBUG
               -->
      
          <Logger name="tc_log" 
                  path="logs/tomcat.log"
                  customOutput="yes" />
      
          <Logger name="servlet_log" 
                  path="logs/servlet.log"
                  customOutput="yes" />
      
          <Logger name="JASPER_LOG" 
      	    path="logs/jasper.log"
                  verbosityLevel = "INFORMATION" />
      
          <!-- Add "home" attribute if you want tomcat to be based on a different directory
               "home" is used to create work and to read webapps, but not for libs or CLASSPATH.
               Note that TOMCAT_HOME is where tomcat is installed, while ContextManager home is the
               base directory for contexts, webapps/ and work/
            -->
          <ContextManager debug="0" workDir="work" >
              <!-- ContextInterceptor className="org.apache.tomcat.context.LogEvents" / -->
              <ContextInterceptor className="org.apache.tomcat.context.AutoSetup" />
              <ContextInterceptor className="org.apache.tomcat.context.DefaultCMSetter" />
              <ContextInterceptor className="org.apache.tomcat.context.WorkDirInterceptor" />
              <ContextInterceptor className="org.apache.tomcat.context.WebXmlReader" />
              <ContextInterceptor className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
              <!-- Request processing -->
              <RequestInterceptor className="org.apache.tomcat.request.SimpleMapper" debug="0" />
              <RequestInterceptor className="org.apache.tomcat.request.SessionInterceptor" />
              <RequestInterceptor className="org.apache.tomcat.request.SecurityCheck" />
              <RequestInterceptor className="org.apache.tomcat.request.FixHeaders" />
      
              <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
                  <Parameter name="handler" value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
                  <Parameter name="port" value="8080"/>
              </Connector>
      
              <Connector className="org.apache.tomcat.service.SimpleTcpConnector">
                  <Parameter name="handler" value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
                  <Parameter name="port" value="8007"/>
              </Connector>
      
          </ContextManager>
      </Server>

    

/usr/local/apache/conf/httpd.conf

     ...........
     #
     # VirtualHost example:
     # Almost any Apache directive may go into a VirtualHost container.
     #
     #<VirtualHost ip.address.of.host.some_domain.com>
     #    ServerAdmin webmaster@host.some_domain.com
     #    DocumentRoot /www/docs/host.some_domain.com
     #    ServerName host.some_domain.com
     #    ErrorLog logs/host.some_domain.com-error_log
     #    CustomLog logs/host.some_domain.com-access_log common
     #</VirtualHost>
     
     #<VirtualHost _default_:*>
     #</VirtualHost>
     
     include /usr/local/jakarta-tomcat/conf/tomcat-apache-cocoon.conf
     

Hints and Tips

Being bit of a XML/XSL/JAVA etc novice, here are some hints that I now know but it would have made life a lot easier if I knew them before I attempted Cocoon/Jakarta-Tomcat/Apache etc..

  • Don't be fooled...use the refresh button on the web browser when fiddling about. The cache is your enemy in the early days !
  • Always stop/start Jakarta-Tomcat and Apache if you are adding/deleting files from the Jakarta-Tomcat webapps directory.
  • Understanding how Cocoon finds the cocoon.properties file is the key.
  • In order to make the starting and stopping of Apache/Jakarta-Tomcat/Cocoon a bit easier on my machine, I modified /usr/local/jakarta-tomcat/bin/tomcat.sh. The complete file listing for /usr/local/jakarta-tomcat/bin/tomcat.sh is shown below. The script starts and stops the Apache server and Jakarta-Tomcat in the correct order and generally just makes life a little easier.

Regards - mark.evans@dsto.defence.gov.au

/usr/local/jakarta-tomcat/bin/tomcat.sh

      #!/bin/sh
      #
      # $Id: installation-case-solaris-8.xml,v 1.2 2000/09/19 23:01:44 greenrd Exp $
      
      # Shell script to start and stop the server
      
      # There are other, simpler commands to startup the runner. The two
      # commented commands good replacements. The first works well with
      # Java Platform 1.1 based runtimes. The second works well with
      # Java2 Platform based runtimes.
      
      TOMCAT_HOME=/usr/local/jakarta-tomcat
      
      JAVA_HOME=/usr/local/j2sdk1_3_0beta_refresh
      
      JAVACMD=/usr/local/j2sdk1_3_0beta_refresh/bin/java
      
      oldCP=$CLASSPATH
      
      CLASSPATH=$TOMCAT_HOME/classes
      
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xerces_1_0_3.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xalan_1_0_1.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/fop_0_12_1.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/servlet_2_2.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/cocoon.jar
      
      
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/webserver.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/jasper.jar
      CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/xml.jar
      #CLASSPATH=$CLASSPATH:$TOMCAT_HOME/lib/servlet.jar
      CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
      
      
      export CLASSPATH
      
      # We start the server up in the background for a couple of reasons:
      #   1) It frees up your command window
      #   2) You should use `stop` option instead of ^C to bring down the server
      if [ "$1" = "start" ] ; then
        shift
      #  echo Using classpath: ${CLASSPATH}
         
        echo __________________________
        echo Stopping Apache Web Server
        echo __________________________
        kill -TERM `cat /usr/local/apache/logs/httpd.pid` >/dev/null
      
        echo ______________________________________
        echo Starting Jakarta-Tomcat in a new shell
        echo ______________________________________
      
        $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME}  org.apache.tomcat.startup.Tomcat "$@" &
      #   $JAVACMD org.apache.tomcat.shell.Startup "$@" &
      
        echo __________________________
        echo Starting Apache Web Server
        echo __________________________
        /usr/local/apache/bin/httpd -d /usr/local/apache 
      
      elif [ "$1" = "stop" ] ; then
        shift
      #  echo Using classpath: ${CLASSPATH}
      
        echo _______________________
        echo Stopping Jakarta-Tomcat
        echo _______________________
        $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat -stop "$@"
      #   $JAVACMD org.apache.tomcat.shell.Shutdown "$@"
      
      elif [ "$1" = "run" ] ; then
        shift
        echo Using classpath: ${CLASSPATH}
        $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME} org.apache.tomcat.startup.Tomcat "$@"
      #  $JAVACMD org.apache.tomcat.shell.Startup "$@"
        # no &
      
      elif [ "$1" = "ant" ] ; then
        shift
      
        $JAVACMD $ANT_OPTS -Dant.home=${TOMCAT_HOME} -Dtomcat.home=${TOMCAT_HOME} org.apache.tools.ant.Main $@
      
      elif [ "$1" = "jspc" ] ; then
        shift
      
        $JAVACMD $JSPC_OPTS -Dtomcat.home=${TOMCAT_HOME} org.apache.jasper.JspC "$@"
      
      elif [ "$1" = "env" ] ; then
        ## Call it with source tomcat.sh to set the env for tomcat
        shift
        echo Setting classpath to: ${CLASSPATH}
        oldCP=$CLASSPATH
      
      else
        echo "Usage:"
        echo "tomcat (start|env|run|stop|ant)"
        echo "	start - start tomcat in the background"
        echo "	run   - start tomcat in the foreground"
        echo "	stop  - stop tomcat"
        echo "	env  -	set CLASSPATH and TOMCAT_HOME env. variables"
        echo "	ant  - run ant script in tomcat context ( classes, directories, etc)"
        echo "	jspc - run jsp pre compiler"
      
        exit 0
      fi


      if [ "$oldCP" != "" ]; then
          CLASSPATH=${oldCP}
          export CLASSPATH
      else
          unset CLASSPATH
      fi

    


Copyright © 1999-2000 The Apache Software Foundation. All Rights Reserved.