Contributor(s): Than Grove
To transform XML content into web pages, THL uses Apache Cocoon as a servlet within Tomcat. Initially, we used Cocoon 2.1.11 built into a servlet by members of the UVa library staff. In April of 2012, it was decided we should begin the migration to Cocoon 2.2, which represents a major shift in architecture and deployment. Cocoon 2.2 is fully modular, its functionality having been segregated into blocks. Furthermore, the Apache Maven program is used, instead of Ant, to build a project from Cocoon. Once the Cocoon WAR file has been built, it is easy to install but the building of the .war file is more complicated issue. To document this process, the steps taken to create the cocoon22.war file presently installed on THL's Development are detailed below.
On Dev1 thlib.org, Tomcat manager was not installed. So, I installed that by:
Tried installing webapp using the manager to see if demo would work before configuring for THL:
Turns out the memory setting for Tomcat was not boosted like it is on old Dev, Staging and Production. So edited the /etc/tomcat6/tomcat6.conf file with vi and added CATALINA_OPTS variable in the following context:
CATALINA_TMPDIR="/var/cache/tomcat6/temp" CATALINA_OPTS="-server -Xmx3000m -Xms3000m -XX:+UseParallelGC -XX:+AggressiveOpts -XX:PermSize=256m -XX:MaxPermSize=512m -Djava.awt.headless=true"
Then restarted Tomcat
Test worked but need to make certain modifications to get it to work in THL.
When this was done for the new production (sdsv11), the URL used to access a cocoon site was ../cocoon/texts but the subfolders (jiats, essays, catalogs, etc.) were all in /usr/local/projects/thlib-texts/current/cocoon/. I thus needed to create a symlink *within* the cocoon folder that was called "texts" but pointed to the cocoon folder so that the url /usr/local/projects/thlib-texts/current/cocoon/texts/ would point to the cocoon folder. Thus within the cocoon folder when you "ls" it, you have the following entry:
lrwxrwxrwx 1 sds-deployer rpcuser 47 Apr 7 07:25 texts -> /usr/local/projects/thlib-texts/current/cocoon/
Add the following code to your pom.xml dependencies:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>3.2.5.RELEASE</version> </dependency>
<!-- Added Dependecies --> <!-- FOP (Added by ndg8f, 2012-05-02 --> <dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-fop-impl</artifactId> <version>1.0.0</version> </dependency>
<dependencies> <dependency> <groupId>org.thlib</groupId> <artifactId>cocoonCore</artifactId> <version>1.0.0</version> </dependency> </dependencies>
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat6-maven-plugin</artifactId> <version>2.3-SNAPSHOT</version> </plugin>
or
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0-SNAPSHOT</version> </plugin>
<!-- Mount everything by calling the sitemap.xmap file located. This will be cocoon/texts on tomcat --> <map:match pattern="*/**"> <map:mount check-reload="${sitemap-mount.check-reload}" src="{1}/" uri-prefix="{1}"/> </map:match>