Outils personnels
Vous êtes ici : Accueil GNU / Linux Debian Installer Cocoon 2.1.x et FOP 0.9x sur Debian 4.0 Etch
Actions sur le document
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Install Cocoon 2.1.x and FOP 0.9x on Debian 4.0 Etch

Par Pierre-Yves Landuré - Dernière modification 10/09/2008 08:40

The 2.1.x versions of Cocoon make use of FOP 0.20.5, a outdated version of this FO processor (FO is a XML standard for printed documents description). This guide help you to replace FOP 0.20.5 by the newer FOP 0.9x.

Installing Java

Cocoon and FOP are Java software. In order to make them work, we need to install the Sun Java virtual machine :
/usr/bin/apt-get install sun-java5-jdk sun-java5-fonts

We set it up as the default Java virtual machine :

/usr/sbin/update-java-alternatives --set java-1.5.0-sun

We also need to install Java Advanced Imaging (JAI), since it is mandatory with the version of FOP provided by Cocoon, as described in this link :

http://mail-archives.apache.org/mod_mbox/cocoon-dev/200309.mbox/%3C20030902231907.GC66223@minotaur.apache.org%3E

In order to do this, we download the i586 binaries of JAI :

/usr/bin/wget http://download.java.net/media/jai/builds/release/1_1_3/jai-1_1_3-lib-linux-i586-jdk.bin \
--output-document=/tmp/jai-1_1_3-lib-linux-i586-jdk.bin

We make the downloaded file runable :

/bin/chmod +x /tmp/jai-1_1_3-lib-linux-i586-jdk.bin

We change directory to the Sun JDK home :

cd /usr/lib/jvm/java-1.5.0-sun/

And we run the JAI installer :

/tmp/jai-1_1_3-lib-linux-i586-jdk.bin

Once the install ended, you can remove the downloaded file :

/bin/rm /tmp/jai-1_1_3-lib-linux-i586-jdk.bin

Building FOP 0.9x

First, we install Ant :

/usr/bin/apt-get install ant ant-optional

Then choose the version of FOP to install :

FOP_VERSION=0.94

Download the sources :

/usr/bin/wget http://apache.miroir-francais.fr/xmlgraphics/fop/source/fop-$FOP_VERSION-src.tar.gz \
--output-document=/tmp/fop-$FOP_VERSION-src.tar.gz

Untar the sources:

/bin/tar --directory /tmp -xzf /tmp/fop-$FOP_VERSION-src.tar.gz

Change directory to the created folder :

cd /tmp/fop-$FOP_VERSION

Build the FOP jars :

/usr/bin/ant package

Building XML Graphics Commons

XML Graphics Commons is a dependency of FOP 0.9x and is not available in Cocoon 2.1.x. We need to integrate it manually.

First, choose the version of XML Graphics Commons to install :

XGC_VERSION=1.2

Download the sources :

/usr/bin/wget http://mirror.ovh.net/ftp.apache.org/dist/xmlgraphics/commons/source/xmlgraphics-commons-$XGC_VERSION-src.tar.gz \
--output-document=/tmp/xmlgraphics-commons-$XGC_VERSION-src.tar.gz

Untar the downloaded file :

/bin/tar --directory /tmp -xzf /tmp/xmlgraphics-commons-$XGC_VERSION-src.tar.gz

Change directory to the created folder :

cd /tmp/xmlgraphics-commons-$XGC_VERSION

Build the jars :

/usr/bin/ant package

Building Cocoon 2.1.x

Now, we need to customize Cocoon sources to integrate the two softwares we just build. First, choose the version of Cocoon you want to install :

VERSION=2.1.11

Then, download the sources :

/usr/bin/wget http://apache.multidist.com/cocoon/cocoon-$VERSION-src.tar.gz \
--output-document=/tmp/cocoon-$VERSION-src.tar.gz

Untar the downloaded file :

/bin/tar --directory /tmp/ -xzf /tmp/cocoon-$VERSION-src.tar.gz

Replace FOP 0.20.5 jar by FOP 0.9x one :

/bin/rm /tmp/cocoon-$VERSION/lib/optional/fop-0.20.5.jar
/bin/cp /tmp/fop-$FOP_VERSION/build/fop.jar /tmp/cocoon-$VERSION/lib/optional/fop-$FOP_VERSION.jar

Add Xml Graphics Commons jar file :

/bin/cp /tmp/xmlgraphics-commons-$XGC_VERSION/build/xmlgraphics-commons-$XGC_VERSION.jar /tmp/cocoon-$VERSION/lib/optional/

Edit the jars.xml file listing all Jars available in Cocoon :

/bin/sed -i \
-e "s/fop-0.20.5/fop-$FOP_VERSION/g" \
-e "/<\/jars>/i\
<file>\\
<title>XML Graphics Commons</title>\\
<description>\\
XML Graphics Commons jar, needed by FOP 0.94\\
</description>\\
<used-by>FOP serializer (fop block)</used-by>\\
<lib>optional/xmlgraphics-commons-$XGC_VERSION.jar</lib>\\
<homepage>http://xmlgraphics.apache.org/</homepage>\\
</file>\\
" /tmp/cocoon-$VERSION/lib/jars.xml

Edit the gump.xml file to insert the XML Graphics Commons jar in the final WAR file :

/bin/sed -i -e '/<library name="fop"\/>/a\
<library name="xmlgraphics-commons"/>' /tmp/cocoon-$VERSION/gump.xml

Download the customized FOPSerializer source for FOP 0.9x (it is a modified version of Cocoon 2.2.x FOPNGSerializer) :

/usr/bin/wget http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-cocoon-2-1-x-et-fop-0-9x-sur-debian-4-0-etch/fopserializer.java \
--output-document=/tmp/cocoon-$VERSION/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java

Change directory to the Cocoon sources folder :

cd /tmp/cocoon-$VERSION

And build Cocoon WAR file :

/bin/sh build.sh war

Installing with Tomcat 5

We install Cocoon in a Tomcat 5 environment. First, install Tomcat :

/usr/bin/apt-get install tomcat5

Now, copy the Cocoon WAR file in the Tomcat webapps folder :

/bin/cp /tmp/cocoon-$VERSION/build/cocoon/cocoon.war /var/lib/tomcat5/webapps/

Download the Tomcat security policy for Cocoon :

/usr/bin/wget http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-cocoon-2-1-x-et-fop-0-9x-sur-debian-4-0-etch/05cocoon-policy \
--output-document=/etc/tomcat5/policy.d/05cocoon.policy

Restart Tomcat 5 to enable the new configuration :

/etc/init.d/tomcat5 restart

Cocoon is now available at : http://localhost:8180/cocoon/

Clean Up

You can now remove the downloaded files and sources :

/bin/rm /tmp/fop-$FOP_VERSION-src.tar.gz
/bin/rm -r /tmp/fop-$FOP_VERSION
/bin/rm /tmp/xmlgraphics-commons-$XGC_VERSION-src.tar.gz
/bin/rm -r /tmp/xmlgraphics-commons-$XGC_VERSION
/bin/rm /tmp/cocoon-$VERSION-src.tar.gz
/bin/rm -r /tmp/cocoon-$VERSION

Thanks

Attachements

Erreur dans l'url des sources FOP

Posté par Nowicki Christophe le 10/09/2008 08:26
Bonjour,

Il y'a une petite typo dans l'url de fop :

/usr/bin/wget http://apache.miroir-francais.fr/xmlgraphics/fop/source/fop-$FOP_VERSION-src.tar.gz \
--output-document=/tmp/fop-$FOP_VERSION-src.tar.gz

Les fichiers ont été déplacées dans le répertoire source.

Voila

Merci pour l'info

Posté par Pierre-Yves Landuré le 10/09/2008 08:46
Merci de m'avoir signalé cette erreur. J'ai corrigé le problème.

J'espère que cet article t'as aidé.

Lone wolf

guest test title

Posté par GuestagecyJN le 20/02/2018 10:03
guest test post
<a href=" http://temresults2018.com/ ">bbcode</a>
<a href="http://temresults2018.com/">html</a>
http://temresults2018.com/ simple

BlogBang
Navigation
 

Réalisé avec Plone

Ce site respecte les normes suivantes :

Wikio