You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark Evans <ma...@dsto.defence.gov.au> on 2000/05/24 09:03:00 UTC

Cocoon V1.7.4 + Tomcat V3.1 + Apache V1.3.12 + Java V1.3 + Windows 2000 : How to get it all working !!

To all potential Cocoon/Tomcat Users,

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

Windows 2000 Professional
Sun Java SDK V1.3
Jakarta-Tomcat V3.1
Cocoon V1.7.4
Apache Web Server V1.3.12
Microsoft Internet Explorer V5.00.2920.0000

This information could be put into the "Working Systems" tables in the
Cocoon "install.html" document at
"http://xml.apache.org/cocoon/install.html".


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 I did it and it wasn't easy !
=================================
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 *extra* 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 !

The relevant sections of the modified files mentioned have been listed
(partially).
(I included the complete files as attachments.)

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.

Warning : This is long and verbose....but its only text !

Note: Before I started this setup on my machine, I did not have any
pre-existing
===== Java SDK, Jakarta-Tomcat, Cocoon, Apache Web Server or even anything
in the
      CLASSPATH env variable. It was a completely new install on a fresh
Windows
      2000 machine

[View the text of this document in the "Courier New 10" font with text wrap
at about 100
 characters and it should all look pretty.]

OK lets go....

Java SDK V1.3
=============
1) Install Sun Java SDK V1.3 via standard install procedure i.e execute the
".exe" file.
2) I chose to install at path "C:\Program_Files\jdk1.3". Note the underscore
in "Program_Files."
3) No worries !

Apache V1.3.12
==============
1) Install Apache V1.3.12 via standard install procedure i.e execute the
".exe" file.
2) I chose to install at path "C:\Program_Files\Apache Group".
3) Modify the "C:\Program_Files\Apache Group\Apache\conf\httpd.conf" file to
   include your machine DNS name. See below.
4) Run the "Install Apache as a service" from the "Apache Web Server" menu
of the
   Windows 2000 Start Menu.
5) Ensure Apache is actually running by opening up the Windows 2000 Control
panel,
   double-left-clicking on "Administrative Tools" and through the "Services"
program,
   highlight the "Apache" service and menu select "Action|Start" i.e start
Apache.
6) Try and access "http://shaggy.dsto.defence.gov.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.
7) No worries !

============================================================================
===
C:\Program_Files\Apache Group\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.dsto.defence.gov.au

....................
============================================================================
===


Tomcat V3.1
===========
1) Install Jakarta-Tomcat via standard install procedure.
2) I chose to install (i.e unpack the zip) at path
"C:\Program_Files\jakarta-tomcat".
   Note the underscore in "Program_Files."
3) Go back to the Apache web site and grab the "ApacheModuleJServ.dll" file
at address
   "http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/win32/i386/"
directory.
4) Copy this file into the "C:\Program_Files\Apache Group\Apache\modules"
directory.
5) Modify the Apache "httpd.conf" file to add the following line to the end
of "httpd.conf"
   "include C:/Program_Files/jakarta-tomcat/conf/tomcat-apache.conf"
   Note the forward "/" slashes in the path name. Note the
"tomcat-apache.conf" file is
   automatically created when tomcat starts.
   See below.
6) Modify "C:\Program_Files\jakarta-tomcat\bin\tomcat.bat" to add env
variables
   TOMCAT_HOME & JAVA_HOME. See below.
7) Open up the Windows 2000 Control panel, double-left-click "Administrative
Tools" and
   execute the "Services" program.
8) Kill Apache - highlight the "Apache" service and menu select
"Action|Stop" i.e stop Apache.
9) Now open up a Windows 2000 "Command Prompt" and cd to directory :
   "C:\program_files\jakarta-tomcat\bin"
10) Type "tomcat start". Tomcat should start up in another Command Prompt
window.
11) Go back to the Windows 2000 "Services" program and start the "Apache"
service i.e "Action|Start".
12) Execute Internet Explorer.
13) Try and access the Tomcat JSP test page
"http://shaggy.dsto.defence.gov.au:8080/examples/jsp/"
    Note the "8080" port in the address.
14) Click on any of the JSP examples to test.
15) Try and access the Tomcat servlet test page
"http://shaggy.dsto.defence.gov.au:8080/examples/servlets/"
    Note the "8080" port in the address.
16) Click on any of the servlet examples to test.
17) Note: You DON'T have to copy the Tomcat
"C:\Program_Files\jakarta-tomcat\webapps\examples" to the
    Apache "C:\Program_Files\Apache Group\Apache\htdocs" directory. Due to
the "8080" port in the
    web addresses shown above, the files in directory
"C:\Program_Files\jakarta-tomcat\webapps\examples"
    are actually referenced automatically by Tomcat. (Contexts, I believe,
is the mechanism.)
18) No worries !

============================================================================
===
C:\Program_Files\Apache Group\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>

#
# Jakarta-Tomcat conf file
#
include c:/program_files/jakarta-tomcat/conf/tomcat-apache.conf

============================================================================
====

============================================================================
===
C:\Program_Files\jakarta-tomcat\bin\tomcat.bat
============================================================================
===
@echo off
rem A batch file to start/stop tomcat server.

rem This batch file written and tested under Windows NT
rem Improvements to this file are welcome

rem Guess TOMCAT_HOME if it is not present


set TOMCAT_HOME=c:\program_files\jakarta-tomcat

set JAVA_HOME=c:\program_files\jdk1.3

.........
============================================================================

Cocoon V1.7.4
=============
1) Install Cocoon via standard install procedure.
2) I chose to install (i.e unpack the zip) at path
"C:\Program_Files\cocoon-1.7.4".
   Note the underscore in "Program_Files."
   (Actually the important files in the Cocoon distribution all end up being
copied
   into the working Jakarta-Tomcat directories, so the unzipped cocoon can
be either
   deleted or left where it is after the files have been copied.)
3) Copy the "xerces_1_0_3.jar", "xalan_1_0_1.jar", "fop_0_12_1.jar" &
"servlet_2_2.jar"
   files, found in the "C:\Program_Files\cocoon-1.7.4\lib" to the
   "C:\Program_Files\jakarta-tomcat\lib" directory.
4) Copy the "C:\Program_Files\cocoon-1.7.4\bin\cocoon.jar" file to the
   "C:\Program_Files\jakarta-tomcat\lib" directory.
5) Modify "C:\Program_Files\jakarta-tomcat\bin\tomcat.bat" to add the five
cocoon jar
   files to the tomcat CLASSPATH env variable. See below.
6) Note the "remed" out "set
CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar" line.
7) Modify the "C:\Program_Files\jakarta-tomcat\conf\web.xml" file to add the
Cocoon
   specific configuration directives. See below.
8) And now for the REALLY REALLY important step, copy the
   "C:\Program_Files\cocoon-1.7.4\conf\cocoon.properties" file to the
   "C:\Program_Files\jakarta-tomcat\webapps\ROOT" directory.
9) 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.
10) OK. To test it all, do the following :
11) If Tomcat is still running, then kill it by typing "tomcat stop" in a
    Windows 2000 "Command Prompt" window which has been cded to
"C:\program_files\jakarta-tomcat\bin".
12) If Apache is still running, then kill it by menu selecting "Action|Stop"
    through the Windows 2000 Services program.
13) Now, start up Tomcat as detailed in the "Tomcat V3.1" notes shown above.
14) Now, start up Apache as detailed in the "Apache V1.3.12" notes shown
above.
15) Execute Internet Explorer.
16) The big test - try and access
"http://shaggy.dsto.defence.gov.au:8080/Cocoon.xml"
    You should get the Cocoon V1.7.4 status page containing all of the
internal
    information and settings specific to Cocoon. Note the "8080" port
number.
    (I have included an attachment called "What Cocoon.xml looks like on my
system.html"
    which is a dump of what "Cocoon.xml" displays on my PC.)
17) Note the capital "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.
18) OK, if the internal Cocoon status page is working then you can try and
access the
    Cocoon examples as follows.
19) Copy the "C:\Program_Files\cocoon-1.7.4\samples" directory to the
    "C:\Program_Files\jakarta-tomcat\webapps" directory.
20) Copy the "cocoon.properties" file to the new
"C:\Program_Files\jakarta-tomcat\webapps\samples"
    directory. Again this is a REALLY REALLY important step.
21) Try and access
"http://shaggy.dsto.defence.gov.au:8080/samples/index.xml". Note the "8080"
port number
22) You should see the Cocoon samples page.
23) Thats it.
24) Again, note that no files were copied into the "C:\Program_Files\Apache
Group\Apache\htdocs"
    directory. The Cocoon samples are found via Tomcat and port 8080.
25) One last thing to try. Create a directory called
"C:\Program_Files\jakarta-tomcat\webapps\gogo".
26) Copy the Cocoon "hello-page.xml" and "hello-page-html.xsl" files found
in the
    C:\Program_Files\cocoon-1.7.4\samples\hello" directory into the new
"gogo" directory.
27) And again the REALLY REALLY important step, copy the "cocoon.properties"
file into the
    new "gogo" directory.
28) Kill tomcat.
29) Kill Apache.
30) Restart tomcat.
31) Restart Apache.
32) Execute Internet Explorer.
33) Try and access "http://shaggy.dsto.defence.gov.au:8080/gogo/hello.xml".
34) You should see the hello page.
35) The purpose of the last few steps was to show how a new auto context can
be
    setup in the tomcat "webapps" directory.
36) As I see it, put your own custom XML/XSL files in a directory that lives
within the tomcat
    "webapps" directory. Make sure "cocoon.properites" is also in there.
37) You could also put your custom XML/XSL work into just the 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

38) Well, thats how I got it to work
39) Works for me and I hope for you too.
40) No worries !

Hints
=====
Being a complete XML/JAVA/XSL 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/Tomcat/Apache etc..

1) Don't be fooled...use the refresh button on the web browser when fiddling
about. The cache is
   your enemy in the early days !
2) Always stop/start tomcat and Apache if you are adding/deleting files from
the tomcat "webapps" directory.
3) Understanding how Cocoon finds the "cocoon.properties" file is the key.


============================================================================
===
C:\Program_Files\jakarta-tomcat\bin\tomcat.bat
============================================================================
===
.................

set cp=%CLASSPATH%

set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes

set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet_2_2.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar

set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
rem set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

.................
============================================================================
C:\Program_Files\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>


<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>

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

..........
====================================================================


SEC: U
______________________________________________________________________
Mark Evans
Defence Science Technology Org. Email:  mark.evans@dsto.defence.gov.au
South Australia                 Web: http://shaggy.dsto.defence.gov.au
______________________________________________________________________