Getting Started Guide
A guide to installing, understanding and features
Index > Books > Cocoon 2 NetKernel Adaption Kit > Getting Started Guide

Cocoon2NetKernel Adaption Kit V0.3.x

Welcome to the Cocoon2NetKernel Adaption Kit. This kit provides a mechanism for using many of the components of the Apache Cocoon project from within 1060 NetKernel. It is provided under the Apache License Version 2.0 licence.


In many ways 1060 NetKernel can be seen as a generalisation of a proven sucessful concept of Apache Cocoon. Because Cocoon has been been around for over 5 years it has built up a large community of contributors and a wealth of reuseable components. This project allows this wealth to be leveraged allowing:

  1. NetKernel developers access to the library of Cocoon components
  2. NetKernel and Cocoon developers to more easily make comparisions between the different approaches of NetKernel and Cocoon.

Guide to Setting Up

1) Prerequisites

Cocoon2NetKernel Adaption Kit requires that you have a distribution of Apache Cocoon and an installed version of NetKernel Standard Edition. This release has been tested with version v2.1.5 of Cocoon and v1.3.0 of NetKernel. Cocoon can be obtained from the Cocoon Site. NetKernel can be obtained from

2) Install NetKernel

If NetKernel is not already installed use the installation process described here.

3) Build Cocoon

Cocoon ships in source code form. Use the supplied build script first.

Certain files from the Cocoon distribution are required to be copied into the Cocoon2NetKernel Adaption Kit module and NetKernel restarted before any Cocoon functionality will be available. How to do this depends upon how you wish to install the Adaption Kit.

3a) Install using a checked out CVS directory from SourceForge

  1. Checkout the latest files from the CVS repository into a local directory under [NetKernel-Install-Path]/modules/
  2. Copy all the JAR files from [Cocoon-Install-Path]/build/webapp/WEB-INF/lib/ to the lib directory directly below your expanded adaption kit module directory. (Two exceptions- don't copy axis-jaxrpc-1.1.jar, xml-apis.jar - they overrides the XML APIs shipped with the JDK). Also copy the file [Cocoon-Install-Path]/lib/optional/servlet_2_2.jar which is needed by the build process.
  3. Build the Adaption Kit using the supplied ANT build script build_mod_cocoon.xml. You will first need to edit this file to specify the location you installed NetKernel.
  4. Edit the file [NetKernel-Install-Path]/etc/deployedModules.xml and add a line to it to reference the new module. Add a line which contains the path to the Adaption Kit module directory. (It must end with a slash.)
  5. Start NetKernel as described in the NetKernel install instructions.

3b) Install using Install Wizard

  1. Start NetKernel and use the Install Wizard to download and install the Cocoon2NetKernel Adaption Kit from one of the 1060 mirrors. You must ensure Display Libraries is select in the wizard.
  2. The Adaption Kit will have been installed as a JAR file this must be expanded so that the cocoon libraries can be added. Expand the JAR to a directory in the same location as the JAR (The directory of this will be [NetKernel-Install-Path]/modules/ )
  3. Edit the file [NetKernel-Install-Path]/etc/deployedModules.xml and change the line which references the adaption kit module jar to reference the new adaption kit module directory. (Take off the .jar and replace with forward slash.
  4. Copy all the JAR files from [Cocoon-Install-Path]/build/webapp/WEB-INF/lib/ to the lib directory directly below your expanded adaption kit module directory. (Two exceptions- don't copy axis-jaxrpc-1.1.jar, xml-apis.jar - they overrides the XML APIs shipped with the JDK).
  5. Perform a NetKernel cold restart.

Check it works

Try out some of the examples below.

Features and Limitations


This adaption kit does not aim to provide complete Cocoon site compatibility:

  1. Only Generators, Transformers and Serializers are supported. Matchers, Selectors, Actions and Readers are not. However the equivalent functionality can be provided in NetKernel specific ways.
  2. Sitemaps are not supported. However alternate pipeline scripting mechanisms such as DPML or XRL can be used.
  3. No access to Object Model. Components do not have access to the underlying object model/environment which is used as a global variable store shared between all components and pipelines executed to satisfy a request. In NetKernel all components must explicitly declare and have passed to them any arguments they require to execute. This enables a strict dependency chain to be generated for any resource improving cacheability and enabling functional programming style lazy evaluation to be acheived. This factor alone is the major reason why some cocoon components may not be useful when running within NetKernel and as such may be addressed in future releases of this Adaption Kit.
  4. No component pooling. NetKernel already caches its components, accessors, so component pooling was deemed unecessary.


If you are new to NetKernel some of the following features may be of interest:
  1. Strict dependency caching. The result of every pipeline is guaranteed to depend upon all resource which it used in its execution. This has two advantages. Optimal caching and reuse is acheived in production and development is easier as results are always recomputed when necessary (just like in a spreadsheet)
  2. Mix SAX with DOM. SAX is more efficient when dealing with large documents in limited memory environments, DOM is necessary for certain classes of complex manipulation. Mix and match within a pipeline if necessary. Indeed you can also use non-XML data types or extend with alternate XML representations such as JDOM or DOM4J. Conversion between representations is usually implicit using NetKernels representation/aspect/transrepresentation abstraction.
  3. Modular configuration. Only the lowest level configuration of the NetKernel kernel is global. All other configuration is modularised within modules this allows concurrent versions to deployed simultaneously without interference. It also allows parts of your application or libraries to be deployed or upgraded safely.
  4. Extensible language support. You are not limited to linear pipelines where components have one input and one output. DPML provides support for components with multiple inputs, conditional and iterative processing and exception handling. New language runtimes can be developed and deployed.
  5. More deployment options. In addition to the deployment options presented by Cocoon, NetKernel can be deployed as an embedded co-processor within an existing Java application. Alternatively custom transports can be developed to create services such as email servers, instant messaging, p2p and mobile messaging services that are not served over HTTP.
  6. Web based management console. Full control and remote admistration of a NetKernel instance is provided with the control panel.
  7. Debugger Breakpoints can be set on instructions within pipelines. When a breakpoint occurs the inputs and outputs can be introspected.


See the examples here.

Errors and Troubleshooting

Error sourcing resource
resource /org/apache/cocoon/cocoon.roles not found
You have not copied the Cocoon jars into the module- see the install guide.
Failed to access Cocoon Object ModelSee the limitations section above.
Unsupported Generator
Unsupported Transformer
Unsupported Serializer
You have mispelled the name of the component class.
Further non Adaption Kit errors are documented here.
© 2003,2004, 1060 Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited