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 its 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:graeme.welling...@ptbuildingsolutions.com.au] Sent: 16 March 2018 00:12 To: fop-users@xmlgraphics.apache.org 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: <mailto:graeme.welling...@ptbuildingsolutions.com.au> graeme.welling...@ptbuildingsolutions.com.au From: Robert Meyer <rme...@hotmail.co.uk <mailto:rme...@hotmail.co.uk> > Sent: Thursday, March 15, 2018 5:58 AM To: fop-users@xmlgraphics.apache.org <mailto:fop-users@xmlgraphics.apache.org> 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 ''. 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) <szea...@gmail.com <mailto:szea...@gmail.com> > Sent: 14 March 2018 13:36 To: fop-users@xmlgraphics.apache.org <mailto:fop-users@xmlgraphics.apache.org> 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 : OR OR 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: ./ 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(Ima geUtil.java:213) at org.apache.xmlgraphics.image.loader.util.ImageUtil.autoDecorateInputStream(I mageUtil.java:228) at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.createI mageSource(AbstractImageSessionContext.java:373) at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.access$ 100(AbstractImageSessionContext.java:53) at org.apache.xmlgraphics.image.loader.impl.AbstractImageSe
RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics
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: graeme.welling...@ptbuildingsolutions.com.au<mailto:graeme.welling...@ptbuildingsolutions.com.au> [PTBSX-Logo] From: Szeak (Register Man) <szea...@gmail.com> Sent: Thursday, March 15, 2018 12:07 AM To: fop-users@xmlgraphics.apache.org 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 : OR OR … 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: ./ 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(XML11Configurat
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 ''. 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) <szea...@gmail.com> Sent: 14 March 2018 13:36 To: fop-users@xmlgraphics.apache.org 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 : OR OR … 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: ./ 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(XML11Config
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 : OR OR … 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: ./ 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