Tomcat has two basic methods of locating Java classes for the runtime environment.
The first is the overall classpath that Tomcat uses to run, and this is the
classpath provided to Java classes that use constructs such as
Class.forName().newInstance()
. The second classpath is
associated with a specific context, and is somewhat analagous to the
servlet zones used in Apache JServ (see section above).
Because the Cocoon framework utilizes Class.forName()
and other
dynamic instance handling techniques, the Cocoon classes need to have its
classpath aware of the component classes used within the framework. To do
this, take all the required components (see above) and put them in your
<Tomcat-Root>/lib directory. This is the standard location
for Tomcat core libraries. To ensure that Tomcat will use these, you need
to edit the Tomcat startup file.
On Windows, this is <Tomcat-Root>/tomcat.bat and on
Unix, this is <Tomcat-Root>/tomcat.sh. In this
file you must add all the component jar files to Tomcat's classpath.
 |
from this version of Cocoon the cocoon.jar
package should be added to the servlet engine classpath as any other
required package (as shown above).
|
Next you need to tell your context where Cocoon can find it's properties
file, as well as to map Cocoon to XML document requests.
Make sure you have a web.xml file in your context's
WEB-INF directory (look in src/WEB-INF/
to find a
template web.xml). This file specifies servlet mappings
and initial arguments to servlets and looks like this:
 |  |  |
 |
<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>
[path-to-cocoon.properties]/cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.cocoon.Cocoon</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
|  |
 |  |  |
Make sure you replaced the path to the Cocoon.properties file with the
actual location of that file on your system.
Note that you should not need to change anything from the template
properties file found in the distribution, but you must edit it for
more complex operation. Please refer directly to the file that contains
brief indications and comments on the different configurations, but you
don't need to care about that at this point.
At this point, you should check if your system matches the global
considerations about Cocoon properties. Usually, you might want to give
the installation a try as it is and then read again that section if
something goes wrong. Most installations don't need any changes to
be operational.
Everything should be configured fine. Restart both Apache and Tomcat
and try accessing the samples contained in the distribution to see
Cocoon in action or the /Cocoon.xml
page for Cocoon internal
status.
 |
Tomcat 3.0 has a bug that prevents Cocoon operation. In order to make
Cocoon work under Tomcat you need to download a newer version or, if
none is yet avaiable, build it from the latest source code found in the
jakarta-tomcat CVS module under jakarta.apache.org.
We apologize for this, but it's not something we can control or work
around.
|