Setting up a fresh Cocoon/eXist: documentation
Posted by mholmes on 23 Oct 2007 in Activity log
This documentation covers the changes you have to make to the default download of Cocoon + eXist built as a WAR file to get everything working for our regular projects (of which teiJournal is a good example). This process was tested using a clean download of Cocoon+eXist today.
- First, rename the
WARfile to "cocoon". If you don't do that, you'll be dealing with ungainly long directory structures for ever. - Next, deploy the
WARfile (i.e. Stop Tomcat if it's running, put theWARfile in its webapps directory, and restart it. - Check that Cocoon has deployed OK by going into the Tomcat manager application to see it, and also going to
:8080/cocoon/. - Stop Cocoon from within the Tomcat manager so you can add some custom Java libraries.
- For
teiJournal, add the following libraries to cocoon/WEB-INF/lib:TitleSortComparator.jar(sorts titles ignoring leading articles, etc.)xqSearchUtils.jar(contains the search-string parsing functionality used for teiJournal's search).
- For support of XSLT 2.0, you need to add and configure the Saxon 8 libraries. Get the Saxon-B download from here. Then extract all the .jar libraries into
cocoon/WEB-INF/lib. - Now we need to configure Cocoon so that Saxon can be called. First, open
cocoon/WEB-INF/cocoon.xconf, and find the bit that refers to Saxon XSLT, which is commented out by default. Uncomment the code and change it according to the instructions in the file, so that it enables Saxon 8:<component logger="core.xslt" role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon" class="org.apache.cocoon.components.xslt.TraxProcessor"> <parameter name="use-store" value="true"/> <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/> </component> - Now we need to edit
cocoon/sitemap.xmapto enable the Saxon transformer. In the<map:transformers>section, add this below the other XSLT transformers:<map:transformer name="saxon" pool-grow="2" pool-max="32" pool-min="8" src="org.apache.cocoon.transformation.TraxTransformer"> <use-request-parameters>false</use-request-parameters> <use-browser-capabilities-db>false</use-browser-capabilities-db> <xslt-processor-role>saxon</xslt-processor-role> </map:transformer> - Add the following in the
<map:serializers>section, to enable a couple more useful output formats:<!-- Customization: compatibility setting for IE6 --> <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html" name="xhtml11_compat" pool-grow="2" pool-max="64" pool-min="2" src="org.apache.cocoon.serialization.XMLSerializer"> <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public> <doctype-system>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</doctype-system> <encoding>UTF-8</encoding> </map:serializer> <!-- Customization: set text output to UTF-8 --> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain" name="text" src="org.apache.cocoon.serialization.TextSerializer"> <encoding>UTF-8</encoding> </map:serializer> - Now, if you're going to use Java Binding in eXist XQuery modules, you'll need to enable it. Open
cocoon/WEB-INF/conf.xml, and change<xquery enable-java-binding="no">to<xquery enable-java-binding="yes">. IF YOU DO THIS, BE AWARE OF THE SECURITY ISSUES -- see below. - Restart Tomcat (restarting just Cocoon doesn't seem to be enough).
- Check that Cocoon is running (
:8080/cocoon/). - Check that eXist is running (:
8080/cocoon/samples/blocks/exist/). - Start the eXist client for the first time (using the
Webstart Client Launchlink on the menu of the page above). - There will be no admin password at first; just log in as admin with no password, then change the admin password. You'll immediately get an error; don't worry, just close the client down and restart it, then log in with the new password.
- Now you can add data and a project folder as necessary, and test the results.
- Now, IF YOU'RE USING JAVA BINDING, you'll need to configure some security using XACML. We don't know how to do that yet :-)