Appendix A

Environment Setup

In order to make the system work, we have to install the following combination of software then do the configuration:

·         Windows 2000 Professional

·         Microsoft Internet Explorer V5.50.4134.0600

·         Nokia WAP Toolkit 2.0

·         Sun Java SDK SE V1.3

·         Apache Web Server V1.3.12

·         Jakarta-Tomcat V3.1

·         Cocoon V1.7.4

Step 1. Basic Environment and Utility Setup

            Install Windows 2000 Professional

            Install Microsoft Internet Explorer V5.50.4134.0600

            Install Nokia WAP Toolkit 2.0

            Install Sun Java SDK SE V1.3 under directory C:\Program Files, then its directory is C:\Program Files\jdk1.3

 

Step 2. Setup Apache Web Server

  1. Install Apache Web Server V1.3.12 under directory C:\Program Files, then its directory is C:\Program Files\Apache Group
  2. Modify the C:\Program_Files\Apache Group\Apache\conf\httpd.conf file to include your machine DNS name or http://127.0.0.1 for local machine. (remember to eliminate # sign before ServerName)

# 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 http://127.0.0.1/

 

 

  1. Run the Install Apache as a Service program from the Apache Web Server menu of the Windows 2000 Start Menu.
  2. Opening up the Windows 2000 Control panel, double-left-clicking on Administrative Tools and through the Services program, highlight the Apache service, right-clicking on mouse to go to properties, change the Startup Type to be manually. Use Menu to select Action|Start i.e start Apache.
  3. Try and access http://127.0.0.1:80. You should see the standard "If you can see this, it means that the installation of the Apache web server software on this system was successful" page.

 

 

 

Step 3. Setup Jakarta-Tomcat to serve Java Servlet

  1. Install Jakarta-Tomcat V3.1 under directory C:\Program Files, then its directory is C:\Program Files\jakarta-tomcat
  2. Go to the Apache web site http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/win32/i386/

And grab the ApacheModuleJServ.dll file then copy this file into the C:\Program Files\Apache Group\Apache\modules directory

  1. Modify the Apache httpd.conf file to add the whole content of "C:/Program Files/jakarta-tomcat/conf/tomcat-apache.conf" file to the end of httpd.conf. See code segment below. The tomcat-apache file is automatically created when Jakarta-Tomcat starts. Note the quote sign " " has to be added in the alias path of /examples and /test.

 

LoadModule jserv_module modules/ApacheModuleJServ.dll

ApJServManual on

ApJServDefaultProtocol ajpv12

ApJServSecretKey DISABLED

ApJServMountCopy on

ApJServLogLevel notice

 

ApJServDefaultPort 8007

 

AddType test/jsp .jsp

AddHandler jserv-servlet .jsp

Alias /examples "C:\Program Files\jakarta-tomcat\webapps\examples"

<Directory "C:\Program Files\jakarta-tomcat\webapps\examples">

    Options Indexes FollowSymLinks

</Directory>

ApJServMount /examples/servlet /examples

<Location /examples/WEB-INF/ >

    AllowOverride None

    deny from all

</Location>

 

Alias /test "C:\Program Files\jakarta-tomcat\webapps\test"

<Directory "C:\Program Files\jakarta-tomcat\webapps\test">

    Options Indexes FollowSymLinks

</Directory>

ApJServMount /test/servlet /test

<Location /test/WEB-INF/ >

    AllowOverride None

    deny from all

</Location>

 

ApJServMount /servlet /ROOT

 

  1. Modify C:\Program Files\jakarta-tomcat\bin\tomcat.bat to add env variables TOMCAT_HOME and JAVA_HOME. See code segment below.

 

 

@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:\jdk1.2.2

 

if not "%TOMCAT_HOME%" == "" goto gothome

 

SET TOMCAT_HOME=.

if exist %TOMCAT_HOME%\bin\tomcat.bat goto gothome

 

  1. Open the Windows 2000 Control Panel, double-left-click Administrative Tools and execute the Services program.
  2. Stop the Apache from menu select Action | Stop.
  3. Open up a Windows 2000 Command Prompt and cd to directory - C:\Program_Files\jakarta-tomcat\bin . Type tomcat start. Jakarta-Tomcat will start up in another Command Prompt window.
  4. Start the Apache service from Windows Services program.
  5. Start Internet Explorer.
  6. Try to access the Jakarta-Tomcat Servlet test page http://127.0.0.1:8080/examples/servlets/ - Note the 8080 port in the address.
  7. Click on any of the servlet examples to test.
  8. If it works, that means Jakarta-Tomcat has connected with Apache.

 

Step 4. Setup Cocoon Servlet

  1. Install Cocoon V1.7.4 under directory C:\Program Files, then its directory is C:\Program Files\cocoon-1.7.4
  2. 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 C:\Program_Files\cocoon-1.7.4\lib to the C:\Program_Files\jakarta-tomcat\lib directory.
  3. Copy the C:\Program_Files\cocoon-1.7.4\bin\cocoon.jar file to the C:\Program_Files\jakarta-tomcat\lib directory.
  4. Modify C:\Program_Files\jakarta-tomcat\bin\tomcat.bat to add the five Cocoon .jar files to the Jakarta-Tomcat CLASSPATH env variable. Note the "remed" out set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar line.

 

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

 

if "%cp%" == "" goto next

 

  1. Modify the C:\Program_Files\jakarta-tomcat\conf\web.xml file to add the Cocoon specific configuration directives.

 

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

 

  1. A very 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.
  2. To test it, Stop Tomcat by typing tomcat stop in a Windows 2000 Command Prompt window which has been cded to C:\Program_Files\jakarta-tomcat\bin. Stop Apache Web Server.
  3. Start Jakarta-Tomcat then Start Apache Web Server. Note: every time we change anything, we have to restart these two in sequence.
  4. Try to access http://127.0.0.1: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.
  5. Now Cocoon has been successfully setup.

 

Step 5. Setup Our Own Stuff

  1. Create a directory called C:\Program_Files\jakarta-tomcat\webapps\wml
  2. Put WML/XML/XSL files inside C:\Program_Files\jakarta-tomcat\webapps\wml directory (such as index.wml, cda_xml.xsl, V3CFNPRA30103721.xml,…)
  3. Very important step, copy the cocoon.properties file into the wml directory where XML/XSL exists.
  4. Create a directory called C:\Program_Files\jakarta-tomcat\webapps\wml\WEB-INF
  5. Create a directory called C:\Program_Files\jakarta-tomcat\webapps\wml\WEB-INF\classes
  6. Put needed Servlet class files inside classes directory (such as CDAServlet.class) .
  7. In order to let Tomcat can recognize correct MIME type of wml related files. Add the following codes into C:\Program_Files\jakarta-tomcat\conf\web.xml file.

 

 

<!-- mime-mapping for  all type of wml file-->

      <mime-mapping>

            <extension>

               wml

             </extension>

            <mime-type>

               text/vnd.wap.wml

             </mime-type>

      </mime-mapping>

      <mime-mapping>

            <extension>

               wmlc

             </extension>

            <mime-type>

               application/vnd.wap.wmlc

             </mime-type>

      </mime-mapping>

      <mime-mapping>

            <extension>

               wmls

             </extension>

            <mime-type>

               text/vnd.wap.wmlscript

             </mime-type>

      </mime-mapping>

      <mime-mapping>

            <extension>

               wmlsc

             </extension>

            <mime-type>

               application/vnd.wap.wmlscriptc

             </mime-type>

      </mime-mapping>

       <mime-mapping>

            <extension>

               wbmp

             </extension>

            <mime-type>

               image/vnd.wap.wbmp

             </mime-type>

      </mime-mapping>

      <!-- finish mapping for wml files -->

     

      <mime-mapping>

            <extension>

               txt

             </extension>

            <mime-type>

               text/plain

 

Step 6. Game Time

  1. Stop Jakarta-Tomcat and Apache Web Server.
  2. Restart Jakarta-Tomcat. Then Restart Apache Web Server.
  3. Start Nokia WAP Toolkit 2.0. We’ll see the Nokia Phone Simulator.
  4. Type http://127.0.0.1:8080/wml/index.wml into Location.
  5. We should see welcome message coming up. Then we can play around.