J2EE and XML
Consulting and Contracting

Candlelight Software

Steven P. Punte
steve@candlelightsoftware.com
707-874-1028

Technotes
Publications

The Cocoon Web Publishing Framework in conjunction with Orion Web Server creates an extremely effective pure java portable combination that has become my favorite. Very little installation and operational differences are seen between deployment on Windows, Linux, or Solaris. Both are freely available for development purpose, and are low cost for production purposes.

I have created several interactive web sites based on these products, and offer software consulting and contracting services in both these technologies in addition to J2EE in general.

If you are launching or already developing a project using these technologies my services can potentially save your enormous time and money. There is nothing more costly than for the development effort to be halted due to some technical difficultly (i.e. jar files from hell or similar).

This section describes how to bring Cocoon release 2.0.3 alive with Orion web server release 1.5.4. Most aspects of Cocoon2 seem operational including the interconnection with MySql database. However, I've noticed a few other corners where more work is needed. But the primary core Cocoon seems operational.

Assumptions and Notes

  • The various software packages can be installed on your system anywhere. The notation used here is always ~<packageName_x.x.x> and should always be replaced with an absolute path name.
  • These installation procedures have been tested and written against installation on Windows 2000, have been successfully tried on RedHat 7, but "should" work on any operating system with perhaps small modifications.
  • JDK1.3.1 is used and is assumed to be located at ~jdk_1.3.1.
  • Every bullet item in this documentation ends with a period: do not incorporate this into any file or path name.

Cocoon Installation

The Cocoon web application is unpacked from its "war" file bundling to be the more conventional topology, allow access to needed libraries, and for easy tinkering and modification.

  • Download cocoon-2.0.3-bin.zip from the Apache Cocoon Web Site.
  • Unzip into directory ~cocoon-2.0.3.
  • Create directory ~cocoon-2.0.3\webapp.
  • cd ~cocoon-2.0.3\webapp.
  • jar xvf ..\cocoon.war.

Orion Installation

This step first installs Orion separate from Cocoon. Get Orion working first independently from Cocoon.

  • Download Orion version 1.5.4 from the Orion Web Site.
  • Unzip into directory ~orion_1.5.4.
  • Copy ~jdk1.3.1\lib\tools.jar to ~orion_1.5.4\tools.jar.
  • Create directory ~orion_1.5.4\persistence (if needed).
  • Execute java -jar orion.jar -install to trigger installation activities. Provide any password of your choosing when prompted. You will be able to change and find this password in file ~orion_1.5.4\config\principals.xml.
  • Test by executing java -jar orion.jar. In a browser load page http://localhost. This should produce the default Orion web application start page.
  • Control-C to end Orion process.

Final Integration

This is the real magic that combines the two together. It is bit untasteful to be modifying jar files in the web server, and perhaps at a later time I will figure out a more elegant solution. But for now this works without too much pain and blasphemy.

  • Delete from the Orion installation files xalan.jar, xerces.jar, and jaxp.jar.
  • Copy ~cocoon-2.0\webapp\WEB-INF\lib\xercesImpl-2.0.0.jar to ~orion_1.5.4\xerces.jar.
  • Copy ~cocoon-2.0\webapp\WEB-INF\lib\xalan-2.3.1.jar to ~orion_1.5.4\xalan.jar.
  • Copy ~cocoon-2.0\webapp\WEB-INF\lib\xml-apis.jar to ~orion_1.5.4\jaxp.jar.
  • Modify file ~orion_1.5.4\config\application.xml element attribute path to equal the location of the cocoon webapp. In my specific setup I have:
      <web-module id="defaultWebApp" path="\C:\opt\cocoon-2.0.3\webapp" />
  • Also in file ~orion_1.5.4\config\application.xml element, add the following equivalent library paths:
      <library path="\C:\opt\cocoon-2.0.3\webapp\WEB-INF\lib" />
      <library path="\C:\opt\cocoon-2.0.3\webapp\WEB-INF\classes" />
    directly after the existing construct:
      <library path="../lib" />
  • Finally, the supplied file ~cocoon-2.0.3\webapp\WEB-INF\lib\batik-all-1.5b2.jar seems to be improperly archived: at least it fails to even list its contents using the jkd1.3.1 jar tool. Download and replace this file with the identically named one from my web site: batik-all-1.5b2.jar. Note: this problem still exists in 2.0.4, but is most likely fixed in 2.1+.
  • Start Orion again like above by executing java -jar orion.jar.
  • Again bring browser to http://localhost; the Cocoon2 start web page should appear.

MySql Integration

  • Download MySql driver mysql-connector-java-2.0.14-bin.jar from MySql and install in location ~cocoon-2.0.3/webapp/WEB-INF/lib.

  • Modify file cocoon.xconf section to:
    
    <datasources>
    	<jdbc logger="core.datasources.personnel" name="personnel">
    		<pool-controller min="5" max="10"/>
    		<dburl>jdbc:mysql://localhost/test</dburl>
    		<user>[username]</user>
    		<password>[userpassword]</password>
    	</jdbc>
    </datasources>
    
  • Modify file web.xml WITHOUT any white spaces:
    
    <init-param>
    	<param-name>load-class</param-name>
    	<param-value>org.gjt.mm.mysql.Driver</param-value>
    </init-param>
    
  • Initialize the database using mysql command line in the following manner:
    
      cd ~cocoon-2.0.3\webapp\docs\samples\sql
      mysql --database=test < sql-page.xml.sql
    
  • Page http://localhost/sql/sql-page should now work!

Operation with JDK 1.4.1

Repeat integration instructions above except with the following changes:

  • Replace ~orion_1.5.4\tools.jar with that from JKD1.4.1\lib\tools.jar
  • Use Apache Cocoon distribution labeled cocoon-2.0.3-vm14-bin.
  • Delete existing ~orion_1.5.4\applications-deployment\default.
  • Restart
  • MySql database operation above also tested.

Post Notes

  • Last Modified 12-13-2002