Share the content if you found it is useful (You can share using 300 community websites) click "share" at the end of the post.

You are encouraged to leave a comment.








Wednesday, September 30, 2009

Configuring Apache FOP for Apex 3.2 PDF Printing

This blog is about Configuring the Apex PDF printing with Apache FOP.

You need to download the OC4J from here
You move the downloaded file to the server where you want to configure. I installed it in the application server where i integrated the Apex with Oracle EBS. (Linux Box)

To integrate the Apex with Oracle EBS (11i/R12) please refer my blog entry http://balajiabhi.blogspot.com/search?q=apex

The server used: genius.chainsys.com
IP: 192.168.2.207
Ports used for Apex: 7778 (Application Server)
OC4J: 8888 (OC4J Instance created with the zip file downloaded)

1. Create a directory called oc4j (it is under /oracle/oc4j)
2. Move the downloaded file to the /oracle/OC4j and extract the content using unzip
3. Read the Readme.txt from the extracted file to start the oc4j
4. Prerequisite for the OC4j will be
Prerequisites
--------------
In order to use the OC4J zip distribution, a Java Platform StandardEdition (Java SE) Development Kit version 6.0, 5.0 (or 1.4.2) must be installed on the host machine.
in my case i chose /usr/java/j2sdk1.4.2_04
Instructions for configuring the OC4J instance:
1. Setup the JAVA_HOME and ORACLE_HOME as
export $ORACLE_HOME=/oracle/OC4j
export $JAVA_HOME=/usr/java/j2sdk1.4.2_04

2. Start the OC4J like (from the server screen itself, Donot use putty or anyother terminal to start oc4j, as it requires the studio to be deployed in the server)
./oc4j -start (from /oracle/OC4j/bin/)
During the startup it will ask you the password for oc4jadmin (In my case it is welcome) confirm the password and it will be initialized)
3. From the browser type http://hostname:8888/
should bring the oc4j webpage.
From the home, select
launch Appliction Server Control
the url will be like http://hostname:8888/em
provide the oc4jadmin password to enter into the ASCONTROL
4. Installing the FOP War:
Place the fop.war file (located in apex_install_directory/utlities/fop) in an accessible location on your local machine.

Navigate to your OC4J Oracle Enterprise Manager Console eg: http://localhost:8888/em/
Select the Applications Tab
Select Deploy Button


Transfer the fop.war from apex/utilities from the apex server to your local machine where you are trying to activate the war through a browser

On the "Deploy: Select Archive" page
use the option "Archive is present on local host. Upload the archive to the server where Application Server Control is running."
Use the file browse to select the fop.war file and click "Next" button


On the "Deploy: Application Attributes" page
Set the "Application Name" option to "fop" and
Clear the "Context Root " option and click "Next" Button


On the Deploy: Deployment Settings click the "Deploy" button









From the home > applications, you can see now, fop is up and running.

Now login to the apex using the url : http://genius:7778/pls/apex_r12/apex_admin
provide the password for administrator and get into the screen as below:

Select the Instance settings from manage services menu as below.

Now configure the printer configuration as below:

Oracle BI Publisher: Standard Support
Print Server Protocol: HTTP or HTTPS (depends on your configuration)
Print Server Host Address: the hostname for the machine where the java container is running - i gave the IP of the server
Print Server Port: the port that the OC4J is listening on - e.g. 8888
Print Server Script: /fop/apex_fop.jsp


Apply the changes and login to the Workspace and developer user. Locate the report to be taken in PDF format.


From the Print Attributes page, pass the values as mentioned in the screen shot:


Apply the changes and click on the report you need to run.



You can see the name of the print label you passed earlier on the report to be taken as PDF. See the image below. Circled with red pen.








Configuration of the Apex with PDF has been finished. When we are running a long report, we get
500 Internal error:
Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.
At the same time, when we look into the log from /OC4J HOME/j2ee/home/application-deployments/fop/fop/application.log, we found:
09/09/30 11:56:27.82 fop: Servlet errorjava.lang.OutOfMemoryError
09/09/30 12:00:13.251 fop: Servlet errorjava.lang.OutOfMemoryError
09/09/30 12:00:20.440 fop: Servlet errorjava.lang.OutOfMemoryError
09/09/30 12:19:05.928 fop: Servlet errorjava.lang.OutOfMemoryError
09/09/30 12:19:16.716 fop: Servlet errorjava.lang.OutOfMemoryError
According the Metalink ID: 744866.1, we did the Memory adjustment, still we are getting the error when we run the large reports.
Will post if any permenent fix for this.
Cheers!!!

3 comments:

Shivani said...

Hi,
Great Yaar ....Its working fine.

Anonymous said...

hi,

if you do not have a OC4J server look at this, it is a free fop server perfect as starting point:

http://www.java4less.com/apache/fop.php

Jayachandran A said...

every thing configured correctly,

but pdf not opening

it shows 500 error internal server error

Related Posts Plugin for WordPress, Blogger...

Let us be Friends...

Share |

Popular Posts

Recent Comments