https://issues.apache.org/bugzilla/show_bug.cgi?id=47341

           Summary: FOP ClassLoader issues
           Product: Fop
           Version: 0.95
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: pdf
        AssignedTo: [email protected]
        ReportedBy: [email protected]


I have built a custom Java server application that is used to host multiple
websites, some of which currently use FOP-0.20.5 for PDF generation. However, I
would like to start using FOP-0.95 for a new site i'm building, and have
encountered a problem:

java.lang.ClassCastException: org.apache.fop.fo.UnknownXMLObj
at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:281)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

I think this has something to do with the ClassLoader setup, because the PDF
file generates without any issues on all FOP versions when I try to generate it
from a simple Java application.

So I did some more research, and created a new test java application which
loads a bunch of jar files into a special ClassLoader object, loads a Runnable
class from the ClassLoader with Class.forName(), and then executes it.

I then wrote a simple Runnable object for both FOP-0.20.5 and FOP-0.95 and
built them into different jar files with the intention to keep them separate
and ensure they belong to the same ClassLoader as the associated FOP libraries.

Now for the test:
FOP-0.20.5: PDF generated without any problems.
FOP-0.95: Failure. Same error as above.

Has anyone else encountered this sort of problem?

If there is no solution for this then it looks like I will be restricted to
only one version of FOP for each server, and will be forced to load all the
libraries in the java command line. If this is the case, I have a LOT of old
xsl-fo files to rewrite to comply with FOP-0.95! :(

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to