xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Steiner" <simonsteiner1...@gmail.com>
Subject RE: FOP 1.1 to 2.2 Migration - SEVERE Error with External Graphics
Date Fri, 16 Mar 2018 10:17:02 GMT
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:graeme.wellington@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.wellington@ptbuildingsolutions.com.au>
graeme.wellington@ptbuildingsolutions.com.au

 



 

From: Robert Meyer <rmeyer@hotmail.co.uk <mailto:rmeyer@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 '<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) <szeak33@gmail.com <mailto:szeak33@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 :

 

<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(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.AbstractImageSessionContext$Unrestr
ictedFallbackResolver.createSource(AbstractImageSessionContext.java:364)

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

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

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

                at
org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.j
ava: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.jav
a:291)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Trans
formerImpl.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(Application
FilterChain.java:231)

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

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

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

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

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

                at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va: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(AbstractAccessLogVa
lve.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(AbstractProtoco
l.java:790)

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

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

                at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
42)

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

                at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.ja
va: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:  <mailto:graeme.wellington@ptbuildingsolutions.com.au>
graeme.wellington@ptbuildingsolutions.com.au

 



 

 


Mime
View raw message