APEX Printing PDF reports using COCOON instead of BI Publisher

Since I think this can be quite useful I’ll write it down in English.

I’ve followed the steps proposed by Carl Backstorm but I’m going to install it in a Linux Server (Ubuntu 8.04).

Files needed:

Cocoon 2.1.11
Tomcat 6
fop_post.zip

Download and decompress them all.

1) Download and decompress cocoon-2.1.11
2) Check JAVA is installed (I installed jdk6) and
be sure JAVA_HOME is set to your actual location:

$ export JAVA_HOME=/usr/

Go to the decompressed folder (cocoon-2.1.11/) and execute:

$ ./build.sh war

3) Notice where cocoon.war was built:

cocoon-2.1.11/build/cocoon

4) Copy cocoon.ware to tomcat in webapps directory

apache-tomcat-6.0.18/webapps/

5) Copy fop_post folder to

apache-tomcat-6.0.18/webapps/cocoon/

6) Start apache tomcat:

Before doing that, you may want to change apache port in order to avoid conflicts with APEX port.
You can change apache 8080 port to 8088 by editing conf/server.xml and replacing 8080 with 8088.

(locate to tomcat folder and run as root)

$ sudo ./bin/startup.sh

7) Check installation is right by accessing http://localhost:8088/cocoon

8) Now, let’s configure APEX in order to be able to print reports in PDF using cocoon:
8.1) Login with internal APEX account
8.2) Go to Manage Service -> Instance Settings -> Report Printing
8.3) Change to new configuration
Print Server Host Address: localhost
Print Server Port: 8088
Print Server Script: /cocoon/fop_post/

9) You may want to start cocoon automatically at startup. Then you can create a file under /etc/init.d like the following one:

/etc/init.d/cocoon.sh

1
2
3
4
#!/bin/bash
JAVA_HOME=/usr/
echo "Starting Apache Cocoon..."
/opt/apache-tomcat-6.0.18/bin/startup.sh

Make it executable

$ sudo chmod +x /etc/bin/cocoon.sh

and add it in your boot process:

$ update-rc.d cocoon.sh defaults

Hope it helps!!

Further information:
http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html