FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Graeme Wellington

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

Reply | Threaded
Open this post in threaded view
|

Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Szeak (Register Man)
Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 


Reply | Threaded
Open this post in threaded view
|

Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Robert Meyer-5
It's been a while, but shouldn't it throw a nicer message than an NPE? Maybe something like "Oh, hello. We see you've not entered a path standard URI format. Instead you've entered '<something>'. Please check and try again".

Then again, FOP's never been that user friendly! I might look into it myself.

Robert

From: Szeak (Register Man) <[hidden email]>
Sent: 14 March 2018 13:36
To: [hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics
 
Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 


Reply | Threaded
Open this post in threaded view
|

RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Graeme Wellington
In reply to this post by Szeak (Register Man)

HI

 

Made those changes to relevant servlet and xsl etc. but no luck.

 

I will send more details in next post.

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

From: Szeak (Register Man) <[hidden email]>
Sent: Thursday, March 15, 2018 12:07 AM
To: [hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

 

Reply | Threaded
Open this post in threaded view
|

FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Graeme Wellington
In reply to this post by Robert Meyer-5

More info…

 

I have several servlets and FOs to test the various combinations:

http://localhost:8080/fop/fop?fo=C:/temp/readme.fo   ; works OK

http://localhost:8080/fop/fop?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopX?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopZ?fo=C:/temp/readmeX.fo ; fails

 

FopServlet.java                 ; as distributed

FopServletX.java              ; attempt to read custom configuration fop.xml

FopServletZ.java              ; attempt to read custom configuration fop.xml / custom Resolver

 

Readme.fo         ; as distributed – works with:      http://localhost:8080/fop/fop?fo=C:/temp/readme.fo

ReadmeX.fo       ; external-graphic included

 

Fop.xml                ; as distributed with base = “.”

 

The batch command generates the PDF successfully (attached):-

"C:\fop-2.2\fop\fop.bat" -fo=C:/temp/readmeX.fo -pdf "C:/temp/FOP-ReadmeX-fo.pdf"  > glw-FO.txt 2>&1

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

From: Robert Meyer <[hidden email]>
Sent: Thursday, March 15, 2018 5:58 AM
To: [hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

It's been a while, but shouldn't it throw a nicer message than an NPE? Maybe something like "Oh, hello. We see you've not entered a path standard URI format. Instead you've entered '<something>'. Please check and try again".

 

Then again, FOP's never been that user friendly! I might look into it myself.

 

Robert


From: Szeak (Register Man) <[hidden email]>
Sent: 14 March 2018 13:36
To:
[hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

 



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

FopServletX.JAVA (14K) Download Attachment
FopServletZ.JAVA (16K) Download Attachment
FopServlet.java (14K) Download Attachment
fop.xml (37K) Download Attachment
readmeX.FO (91K) Download Attachment
readme.fo (90K) Download Attachment
FOP-ReadmeX-fo.pdf (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Simon Steiner

Hi,

 

I could get round this by using in the fopservlet, but I think it’s a security issue allowing filesystem access from tomcat

 

            public Resource getResource(URI uri) throws IOException {

                if (uri.toASCIIString().startsWith("file:")) {

                    return new Resource(new FileInputStream(uri.getPath()));

                }

                return new Resource(getServletContext().getResourceAsStream(uri.toASCIIString()));

            }

Thanks

 

From: Graeme Wellington [mailto:[hidden email]]
Sent: 16 March 2018 00:12
To: [hidden email]
Subject: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

More info…

 

I have several servlets and FOs to test the various combinations:

http://localhost:8080/fop/fop?fo=C:/temp/readme.fo   ; works OK

http://localhost:8080/fop/fop?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopX?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopZ?fo=C:/temp/readmeX.fo ; fails

 

FopServlet.java                 ; as distributed

FopServletX.java              ; attempt to read custom configuration fop.xml

FopServletZ.java              ; attempt to read custom configuration fop.xml / custom Resolver

 

Readme.fo         ; as distributed – works with:      http://localhost:8080/fop/fop?fo=C:/temp/readme.fo

ReadmeX.fo       ; external-graphic included

 

Fop.xml                ; as distributed with base = “.”

 

The batch command generates the PDF successfully (attached):-

"C:\fop-2.2\fop\fop.bat" -fo=C:/temp/readmeX.fo -pdf "C:/temp/FOP-ReadmeX-fo.pdf"  > glw-FO.txt 2>&1

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

From: Robert Meyer <[hidden email]>
Sent: Thursday, March 15, 2018 5:58 AM
To: [hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

It's been a while, but shouldn't it throw a nicer message than an NPE? Maybe something like "Oh, hello. We see you've not entered a path standard URI format. Instead you've entered '<something>'. Please check and try again".

 

Then again, FOP's never been that user friendly! I might look into it myself.

 

Robert


From: Szeak (Register Man) <[hidden email]>
Sent: 14 March 2018 13:36
To:
[hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

 

Reply | Threaded
Open this post in threaded view
|

RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

Graeme Wellington

Hi Simon

 

Awesome!!!

 

I modified the existing FopServlet.java with 1 import statement [import java.io.FileInputStream;] and your lines of code and set the external-graphic to the basic syntax as below and all worked as expected!!!

 

I have spent the last 5 days reading every post and resource available and tested all possible solutions including various methods to set the Base Directory,  making my own ResourceResolver, and custom Configuration files to no avail (although a good learning experience).

 

                  <fo:block>

                                                <fo:external-graphic src="graphics/tomcat.gif"/>

                  </fo:block>

 

Now back to work…

 

Thank you.

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

From: Simon Steiner <[hidden email]>
Sent: Friday, March 16, 2018 8:47 PM
To: [hidden email]
Subject: RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

Hi,

 

I could get round this by using in the fopservlet, but I think it’s a security issue allowing filesystem access from tomcat

 

            public Resource getResource(URI uri) throws IOException {

                if (uri.toASCIIString().startsWith("file:")) {

                    return new Resource(new FileInputStream(uri.getPath()));

                }

                return new Resource(getServletContext().getResourceAsStream(uri.toASCIIString()));

            }

Thanks

 

From: Graeme Wellington [[hidden email]]
Sent: 16 March 2018 00:12
To: [hidden email]
Subject: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

More info…

 

I have several servlets and FOs to test the various combinations:

http://localhost:8080/fop/fop?fo=C:/temp/readme.fo   ; works OK

http://localhost:8080/fop/fop?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopX?fo=C:/temp/readmeX.fo ; fails

http://localhost:8080/fop/fopZ?fo=C:/temp/readmeX.fo ; fails

 

FopServlet.java                 ; as distributed

FopServletX.java              ; attempt to read custom configuration fop.xml

FopServletZ.java              ; attempt to read custom configuration fop.xml / custom Resolver

 

Readme.fo         ; as distributed – works with:      http://localhost:8080/fop/fop?fo=C:/temp/readme.fo

ReadmeX.fo       ; external-graphic included

 

Fop.xml                ; as distributed with base = “.”

 

The batch command generates the PDF successfully (attached):-

"C:\fop-2.2\fop\fop.bat" -fo=C:/temp/readmeX.fo -pdf "C:/temp/FOP-ReadmeX-fo.pdf"  > glw-FO.txt 2>&1

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

From: Robert Meyer <[hidden email]>
Sent: Thursday, March 15, 2018 5:58 AM
To: [hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

It's been a while, but shouldn't it throw a nicer message than an NPE? Maybe something like "Oh, hello. We see you've not entered a path standard URI format. Instead you've entered '<something>'. Please check and try again".

 

Then again, FOP's never been that user friendly! I might look into it myself.

 

Robert


From: Szeak (Register Man) <[hidden email]>
Sent: 14 March 2018 13:36
To:
[hidden email]
Subject: Re: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics

 

Hi,

FOP from version 2 using standard URI format for pathes.
So you need to set the pathes in this format also in your FOP config and in FO.
Ie.: /C/Temp/tomcat.gif or ///C/Temp/tomcat.gif

Best regards, Szeak

2018-03-14 03:12 keltezéssel, Graeme Wellington írta:

Hi

 

I have just migrated to FOP 2.2 - I am using apache-tomcat-8.5.29 / Java 1.8

 

I am using a FOP servlet to render PDF form XML data source.

 

I have a basic example that works on FOP 1.1 but not FOP 2.2

 

http://localhost:8080/fop/fopZ?fo=C:/temp/readme.fo

 

The readme.fo comes with the FOP distribution.

 

Without change the servlet works ok and I get a PDF.

 

When I try and add 1 line to include an image I get SEVERE error as below.

 

I have tried various permutations if the following lines separately but no luck :

 

<fo:external-graphic src="C:/Temp/tomcat .gif"/>

OR

                <fo:external-graphic src="tomcat.gif"/>  

                OR

                <fo:external-graphic src="../graphics/tomcat.gif"/>  

                …

 

I have loaded the tomcat.gif at the various locations to match.

 

However I do not think it is getting that far.

 

I have a customised configuration file and have set the base as follows:

 

<base>./</base>

 

 

Can anyone help?

 

 

Mar 14, 2018 12:06:34 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [FopZ] in context with path [/fop] threw exception [javax.xml.transform.TransformerException: java.lang.NullPointerException] with root cause

java.lang.NullPointerException

                at java.io.FilterInputStream.markSupported(FilterInputStream.java:243)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.decorateMarkSupported(ImageUtil.java:213)

                at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(ImageUtil.java:228)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createImageSource(AbstractImageSessionContext.java:373)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$100(AbstractImageSessionContext.java:53)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext$UnrestrictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:94)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:126)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)

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

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)

                at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)

                at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:247)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

                at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)

                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)

                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)

                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:737)

                at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:351)

                at org.apache.fop.servlet.FopServletZ.render(FopServletZ.java:293)

                at org.apache.fop.servlet.FopServletZ.renderFO(FopServletZ.java:232)

                at org.apache.fop.servlet.FopServletZ.doGet(FopServletZ.java:169)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

                at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

                at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

                at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

                at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)

                at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

                at java.lang.Thread.run(Thread.java:745)

 

 

 

Regards

 

Graeme Wellington

Pro-Time Building Solutions Pty Ltd

178 Martin Road WALL FLAT SA 5254

Mobile: 0419 808 473

Email: [hidden email]

 

PTBSX-Logo

 

 



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Readme and Weep.pdf (286K) Download Attachment