Cocoon on iPlanet
iPlanetTM Application Server Samples

Updated June 12, 2001

If you already went through the process of deploying Cocoon to iPlanet you can access the Cocoon status page by clicking here and you can access the Cocoon samples page by clicking here.

Cocoon is a Java-based publishing framework for web containers. The sample applications have been configured with iPlanet-specific deployment descriptors. Visit the Cocoon home page for more information about the project. A few interesting points from the official Cocoon web pages:  

"The Cocoon project aims to change the way web information is created,rendered and served."

"Even if the most common use of Cocoon is the automatic creation of HTML through the processing of statically or dynamically generated XML files,Cocoon is also able to perform more sophisticated formatting, such as XSL:FO rendering to PDF files, client-dependent transformations such as WML formatting for WAP-enabled devices, or direct XML serving to XML and XSL aware clients."

The samples that ship with Cocoon are functionally rich and provide adequate proof of Cocoon as a framework for web-based publishing. They demonstrate:

Setting Up the Environment

Getting Started includes a checklist of prerequisites for deploying sample applications to iPlanet.

Installing the Cocoon framework on iPlanet describes how to install the Cocoon libraries onto the server once so that it can be used by several applications

Assembling, Deploying and Running the Application

Assembling and Deploying Cocoon with ANT describes how to use an ANT script to create a WAR file that is subsequently deployed to the iPlanet Application Server.

Command Line-based Deployment describes how to manually register the application in iPlanet using a Command Line Interface (CLI). This is the fastest means of deploying the application.

Running the Cocoon Samples describes how to start the application, navigate through it and how to troubleshoot in the event of problems.

Further Exploration

Rebuilding Cocoon 1.8 describes the process of building the Cocoon framework from scratch.

Further Reading provides pointers to other locations for more information about Cocoon.


Installing the Cocoon Framework on iPlanet

Prior to deploying and exercising the samples, the Cocoon framework libraries need to be included in the server runtime. This is done so that several applications can use Cocoon without having to repackage the framework libraries individually into each WAR/EAR.

Note: It is possible to include all the framework classes into the WAR file so as to create a self contained entity. However, since framework applications like Cocoon are typically used by several applications, we recommend that they be installed on the server classpath so as to be available for all applications.

The Cocoon framework is NOT included in the iPlanet Application Server distribution in iAS 6 sp3. It will have to be downloaded from the Apache site.

1. Download Apache Cocoon 1.8 to install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8.tar.gz.

Note : This sample has been tested only with Apache Cocoon version 1.8.

2. Unzip and extract cocoon-1.8.tar.gz:

This will create and populate the directory install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/

3. If it does not already exist, create the frameworks/ directory under the iPlanet install. This is a single repository to hold all framework classes that you would use on the server.

mkdir install_dir/ias/frameworks/

4. Create a subdirectory for housing the Cocoon framework:

mkdir install_dir/ias/frameworks/cocoon

5. Copy  the following files from the expanded Cocoon directory to install_dir/ias/frameworks/cocoon

install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/bin/cocoon.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/bsf.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/bsfengines.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/xalan_1_2_D02.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/xerces_1_2.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/fop_0_13_0.jar
install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/lib/turbine-pool.jar

6. Add the Cocoon libraries to the application server's CLASSPATH

UNIX:

Windows:

To pickup the CLASSPATH changes, restart the application server.

The Cocoon framework is now a part of the application server runtime.


Assembling and Deployong Cocoon with ANT

This section describes the steps to be followed to create a web archive (WAR) containing all teh Cocoon samples.

1. Compile and Assemble the Web Application

Execute "build" under xml/cocoon/src/

The default target core will be executed to rebuild the WAR file. The script assumes that the cocoon1.8 package has been extracted to xml/cocoon/cocoon-1.8. The cocoon.war file is created un xml/cocoon/assemble/war

2. Redeploy Application

Execute "build deploy" under xml/cocoon/src/

3. Restart Application Server

This is only needed if this is NOT the first deployment of the application.


Command Line-based Deployment

Since the cocoon.war file is not supplied with the Cocoon distribution, it must be assembled manually. Within the WAR module reside the XML deployment descriptor files, application class files, JSPs and other content required by the application. Once the cocoon.war file is assembled:

1. Once the application has been assembled, go to:

install_dir/ias/ias-samples/xml/cocoon/assemble/war

2. Execute iasdeploy to deploy application to the local application server instance:

iasdeploy deploymodule cocoon.war

Refer to the Getting Started section for more information on using the iasdeploy command.

The deployment process involves the following operations:

Now you are ready to exercise the Cocoon samples.


Running the Cocoon Samples

Accessing the Cocoon Status Page

First access the Cocoon status page by going to the following URL:

http://<web server hostname>:<port>/NASApp/cocoon/Cocoon.xml

Alternatively, you can access the Cocoon status page by clicking here.

The status page should look like this:

Accessing the Cocoon Samples Page

To access the Cocoon samples, go to the following URL:

http://<web server hostname>:<port>/NASApp/cocoon/samples/index.xml

Alternatively, you can access the Cocoon samples page by clicking here.

The Cocoon sample page should look like this:

 

Troubleshooting

If you encounter problems when running the application, review the General Troubleshooting section to learn how to view logs files.


Rebuilding Cocoon 1.8

This section describes how to use the command line tools to rebuild the Cocoon infrastructure. You do not need to rebuild the framework to run the Cocoon samples. The only reason you might want to rebuild Cocoon is to experiment with changes made to the Cocoon framework.

1. Go to install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8

2. Change JAVA_HOME in build.bat (on Windows) or build.sh (on Unix). Set it to install_dir/ias/usr/java

3. Execute the build script:

Windows:         .\build.bat package

UNIX: ./build.sh package

Note: Make sure that you are executing the build script in the local directory. Otherwise, it might conflict with the build scripts that ship with the application server.

This step creates the file install_dir/ias/ias-samples/xml/cocoon/cocoon-1.8/build/cocoon.jar

You can copy this JAR file into the ias/frameworks/cocoon/ directory and restart the application server to deploy the rebuilt Cocoon framework.


Further Reading

Copyright(c) 2001 Sun Microsystems, Inc. All rights reserved.