Bug 51617 - No embedded examples is working with FOP.jar 1.0 and JDeveloper 10g
Summary: No embedded examples is working with FOP.jar 1.0 and JDeveloper 10g
Status: CLOSED WORKSFORME
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: fo tree (show other bugs)
Version: 1.0
Hardware: PC Windows XP
: P5 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-04 19:38 UTC by daniel.gagnon
Modified: 2012-04-30 00:19 UTC (History)
0 users



Attachments
console output (3.84 KB, text/plain)
2012-04-14 18:13 UTC, Glenn Adams
Details

Note You need to log in before you can comment on or make changes to this bug.
Description daniel.gagnon 2011-08-04 19:38:51 UTC
Hello,

I was trying to understand how FOP is working and I downloaded the latest stable version and created a new project in JDeveloper 10g.  I'm using the binary release 1.0 .  I could do run succesfully the examples using the command line.  But when I'm trying to call it from any application, I always stumble on the same error which is the following (It's almost the same with all the example I tried) :

XML-22900: (Fatal Error) An internal error condition occurred.

javax.xml.transform.TransformerException: XML-22900: (Fatal Error) An internal error condition occurred.

	at oracle.xml.jaxp.JXTransformer.reportException(JXTransformer.java:775)

	at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:374)

	at mypackage3.ExampleXML2PDF.main(ExampleXML2PDF.java:80)

Caused by: java.lang.NullPointerException

	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)

	at oracle.xml.parser.v2.XSLEventHandler.reportStartElement(XSLEventHandler.java:230)

	at oracle.xml.parser.v2.XSLEventHandler.startElement(XSLEventHandler.java:296)

	at oracle.xml.parser.v2.XSLResultElement.processAction(XSLResultElement.java:142)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLResultElement.processAction(XSLResultElement.java:180)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:191)

	at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:210)

	at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:123)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:191)

	at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:509)

	at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:265)

	at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:358)

	... 1 more

---------

java.lang.NullPointerException

	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)

	at oracle.xml.parser.v2.XSLEventHandler.reportStartElement(XSLEventHandler.java:230)

	at oracle.xml.parser.v2.XSLEventHandler.startElement(XSLEventHandler.java:296)

	at oracle.xml.parser.v2.XSLResultElement.processAction(XSLResultElement.java:142)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLResultElement.processAction(XSLResultElement.java:180)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:191)

	at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:210)

	at oracle.xml.parser.v2.XSLApplyTemplates.processAction(XSLApplyTemplates.java:123)

	at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:417)

	at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:191)

	at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:509)

	at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:265)

	at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:358)

	at mypackage3.ExampleXML2PDF.main(ExampleXML2PDF.java:80)

Debugger disconnected from local process.
Process exited.

After analysing the error, I found that the attribute "delegate" is always null after running : transformer.transform(src, res);

Since those are your examples, they should work and have no errors.  Just for fun I did edited the FOTreeBuilder class in the FOP.jar, adding if (delegate == null) {this.startDocument()}

So it began to work without errors, thought it's not correct since the PDF file is unreadable.  I've tried the following examples :

ExampleFO2.java
ExampleXML2PDF.java
and the example in the user guide.

The only difference between your files and mine is that I created my own package in JDev, but I did copy/paste all the rest of your code.

I'll continue to search a way to correct the error.
Comment 1 Glenn Adams 2012-04-07 01:44:53 UTC
resetting P2 open bugs to P3 pending further review
Comment 2 Glenn Adams 2012-04-08 09:09:26 UTC
lowering priority as this does not affect features or performance
Comment 3 Glenn Adams 2012-04-14 18:12:31 UTC
unable to reproduce in 1.1dev (trunk); see console.log.txt attachment; see also http://svn.apache.org/viewvc?rev=1326166&view=rev for minor change to add 'run' target, etc.

n.b. from the backtrace in comment 0, i can see that your JDev environment is making use of a different implementation of javax.xml.transform.Transformer than is normally used by FOP:

you used:

oracle.xml.jaxp.JXTransformer

while FOP normally uses:

org.apache.xalan.transformer.Transform

so I think the problem is that you aren't using xalan-2.7.0.jar as found in $FOP_HOME/lib
Comment 4 Glenn Adams 2012-04-14 18:13:21 UTC
Created attachment 28608 [details]
console output
Comment 5 Glenn Adams 2012-04-30 00:19:38 UTC
batch transition resolved+worksforme to closed+worksforme; if you believe this
remains a bug and can demonstrate it with appropriate input FO file and output
PDF file (as applicable), then you may reopen