Cocoon
It is highly recommended that you use Tomcat 3.2.1 or higher, since it is more secure and supports virtual hosting with or without using separate JVMs.
To make Cocoon work with Tomcat, add a context to Tomcat that describes to Tomcat how to load Cocoon files. Then tell Apache to send certain requests to Tomcat (and subsequently to Cocoon). Finally you must provide the .xml files to be served by Cocoon. These steps are outlined below.
1.Download Cocoon 1.8 from http://xml.apache.org/cocoon/dist/ with the following command:
wget http://xml.apache.org/cocoon/dist/Cocoon-1.8.tar.gz
2.Decompress Cocoon file:
Tar -xzvf Cocoon-1.8.tar.gz
3.Move the Cocoon folder to:
mv cocoon-1.8/ /usr/local/
4.Make sure that Tomcat knows how to load Cocoon .jar files. Copy any .jar files that are necessary for Cocoon to run from $COCOON_HOME/lib to $TOMCAT_HOME/lib. In addition, you must copy $COCOON_HOME/bin/cocoon.jar to $TOMCAT_HOME/lib. In recent versions of Tomcat, under Unix and Windows Tomcat will automatically detect any .jarfiles in the $TOMCAT_HOME/lib directory.
5.Instruct Tomcat about the new context required to run Cocoon requests. Edit the file $TOMCAT_HOME/conf/server.xml. Add the following lines:
<Context path="/cocoon" docBase="webapps/cocoon" debug="0" reloadable="true" >
</Context>
This tells Tomcat that requests that come in under that partial path "/cocoon" should be mapped to the context defined in the directory "webapps/cocoon".
6.The setup for mod_jkajp13 is simpler (see also the mod_jk HOWTO for more details). Add the following code to the $TOMCAT_HOME/conf/mod_jk.conf file in the corresponding sections:
Alias /cocoon $TOMCAT_HOME/webapps/cocoon
<Directory "$TOMCAT_HOME/webapps/cocoon">
Options Indexes FollowSymLinks
</Directory>
JkMount /cocoon/*.xml ajp13
AddType text/xml .xml
<Location /cocoon/WEB-INF/ >
AllowOverride None
deny from all
</Location>
7.Setup the context that you have defined and pointed requests to above. To do this, create a new directory in $TOMCAT_HOME/webapps/ named cocoon.
The command to create the directory is:
mkdir $TOMCAT_HOME/webapps/cocoon
8.Make a sub-directory called $TOMCAT_HOME/webapps/cocoon/WEB-INF that instructs Tomcat to map particular files to Cocoon. Use this command to create the directory:
mkdir $TOMCAT_HOME/webapps/cocoon/WEB-INF
9.Fill the sub-directory with the Cocoon source files (.xml files).
To copy the files use the following two commands:
cp $COCOON_HOME/src/WEB-INF/web.xml $TOMCAT_HOME/webapps/cocoon/WEB-INF
cp $COCOON_HOME/conf/cocoon.properties $TOMCAT_HOME/webapps/cocoon/WEB-INF
10.Edit the $TOMCAT_HOME/webapps/cocoon/WEB-INF/web.xml file so that it points to the Cocoon properties file in the same directory. To do this, change the file name to:
conf/cocoon.properties to WEB-INF/cocoon.properties.
Note, this path is a relative path. Do not try to use an absolute path here, it will not work. Also, note that the web.xml file describes how to map .xml requests to the Cocoon servlet.
11. Populate the cocoon context with source .xml files. For testing you can just use the samples that come with Cocoon. Use this command to populate:
cp -R $COCOON_HOME/samples $TOMCAT_HOME/webapps/cocoon/samples
12.Shutdown Tomcat and Apache, then restart the two to load the new settings. Access the test pages by entering the address:
http://your.machine/cocoon/Cocoon.xml
and/or
http://your.machine/cocoon/samples/index.xml