Added the fop-hyph.jar note
converted to 1.6 markup
|No differences found!|
This page describes how to use Apache FOP to work within the JBoss application server. JBoss's use of commons-logging and Log4J for its internal server logging can cause a FOP exception due to logging jar file classloading clashes. This page will explain how to get Apache FOP and JBoss AS to both work using commons-logging, but different underlying logging implementations.
Please note that this is for FOP 0.91 or greater only.
Get the Apache FOP jars
You can download them at: http://www.apache.org/dyn/closer.cgi/xmlgraphics/fop
- Download and unpack the FOP jar files into a separate directory. You can put the jars into the JBoss server's "lib" directory, but for more load control, I prefer specifying the jars directly. In this example, my jar directory is called "prod_jars_091_14" and is located on the root of from drive.
In your JBoss "bin" directory, locate the "run" batch or shell file. In this file you will need to alter the JBOSS_CLASSPATH to include all of the FOP jars and the log4j-boot.jar included in the JBoss distribution. You may also want to make a copy of this file if you have multiple JBoss servers running. A batch file example snippet is shown below:
<snip/> REM First set up the new APPJARS variable to include all necessary application jars set APPJARS= set APPJARS=%APPJARS%;\prod_jars_091_14\avalon-framework-4.2.0.jar set APPJARS=%APPJARS%;\prod_jars_091_14\batik-all-1.6.jar set APPJARS=%APPJARS%;\prod_jars_091_14\commons-io-1.1.jar set APPJARS=%APPJARS%;\prod_jars_091_14\commons-logging-1.0.4.jar set APPJARS=%APPJARS%;\prod_jars_091_14\serializer-2.7.0.jar set APPJARS=%APPJARS%;\prod_jars_091_14\xalan-2.7.0.jar set APPJARS=%APPJARS%;\prod_jars_091_14\xercesImpl-2.7.1.jar set APPJARS=%APPJARS%;\prod_jars_091_14\xml-apis-1.3.02.jar set APPJARS=%APPJARS%;\prod_jars_091_14\fop.jar REM Now add JBoss's included log4j jar set APPJARS=%APPJARS%;\jboss403SP1\lib\log4j-boot.jar <snip/> REM Now add our new APPJARS variable to the JBOSS_CLASSPATH if "%JBOSS_CLASSPATH%" == "" ( set JBOSS_CLASSPATH=%APPJARS%;%APPJARSPOST%;%JAVAC_JAR%;%RUNJAR% ) ELSE ( set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%APPJARS%;%APPJARSPOST%;%JAVAC_JAR%;%RUNJAR% <snip/>
Follow the same procedure for the shell script (just use scripting language instead).
- Start JBoss using your new "run" file:
run -c fop-server
- Monitor the JBoss boot log to ensure that logging has initialized correctly.
- Adding of the log4j-boot.jar is necessary as JBoss uses log4j for internal logging. Not adding this to the classpath will cause several JBoss components to fail on boot and the AS will be generally non-functional.
- If your require hyphenation support, you will need to add the fop-hyph.jar to he classpath like so (after fop.jar):
This file is currently available from http://prdownloads.sourceforge.net/offo/offo-hyphenation-fop-unstable.zip?download)