tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terence M. Bandoian" <tere...@tmbsw.com>
Subject RE: The resource path [...] is not valid
Date Fri, 02 Oct 2015 21:17:01 GMT
On 10/2/2015 10:28 AM, Chen Yang wrote:
> I wonder if it's because of this?
>
> org.apache.fop.servlet.FopServlet$1.getResource(FopServlet.java:116)
>
> this.uriResolver = new ServletContextURIResolver(getServletContext());
>          this.transFactory = TransformerFactory.newInstance();
>          this.transFactory.setURIResolver(this.uriResolver);
>          //Configure FopFactory as desired
>          ResourceResolver resolver = new ResourceResolver() {
>              public OutputStream getOutputStream(URI uri) throws IOException {
>                  URL url = getServletContext().getResource(uri.toASCIIString());
>                  return url.openConnection().getOutputStream();
>              }
>
>              public Resource getResource(URI uri) throws IOException {
>                  return new Resource(getServletContext().getResourceAsStream(uri.toASCIIString()));
   //line 116
>              }
>          };
>          FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), resolver);
>
> root cause
> java.lang.IllegalArgumentException: The resource path [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/]
is not valid
> 	org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:250)
> 	org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212)
> 	org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:206)
> 	org.apache.fop.servlet.FopServlet$1.getResource(FopServlet.java:116)
> 	org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)
> 	org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:78)
> 	org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:411)
> 	org.apache.fop.apps.FOUserAgent$1.resolveURI(FOUserAgent.java:160)
> 	org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:92)
> 	org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:191)
> 	org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)
> 	org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)
> 	org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
> 	org.apache.fop.fo.FObj.processNode(FObj.java:129)
> 	org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)
> 	org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179)
> 	com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(Unknown Source)
> 	com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(Unknown Source)
> 	com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown Source)
> 	com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(Unknown Source)
> 	GregorSamsa.insert_cover_page_template()
> 	GregorSamsa.template$dot$0()
> 	GregorSamsa.applyTemplates()
> 	GregorSamsa.transform()
> 	com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(Unknown Source)
> 	com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
> 	com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
> 	org.apache.fop.servlet.FopServlet.render(FopServlet.java:397)
> 	org.apache.fop.servlet.FopServlet.renderXML(FopServlet.java:342)
> 	org.apache.fop.servlet.FopServlet.doGet(FopServlet.java:150)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> 	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>
>
>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Friday, October 02, 2015 11:05 AM
> To: Tomcat Users List<users@tomcat.apache.org>
> Subject: Re: The resource path [...] is not valid
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Chen,
>
> On 10/2/15 10:42 AM, Chen Yang wrote:
>> >I'm transforming xml into pdf files, but getting this strange error in
>> >my log. (tomcat 8.0.26)
>> >
>> >The resource path
>> >[file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208.0/
> ]
>> >is not valid
>> >
>> >Here is my code
>> >
>> >//Setup sources StreamSource xmlSrc = new StreamSource(new URL(rootUrl
>> >+ "/output/xml/" + xml).openStream()); StreamSource xsltSrc = new
>> >StreamSource(new URL(rootUrl + "/output/xslt/" + xslt).openStream());
> What's the value of "rootUrl"?
>
>> >//Setup the XSL transformation Transformer transformer =
>> >this.transFactory.newTransformer(xsltSrc);      //error out
>> >transformer.setURIResolver(this.uriResolver);
>> >
>> >XML & XSLT file are not stored locally, so I don't understand why it's
>> >looking at the tomcat folder?
> What's the stack trace?
>
> - -chris


Are you able to execute the transformation stand-alone (not within Tomcat)?

Also, you may want to ask this on the Apache FOP users mailing list:

     https://xmlgraphics.apache.org/fop/maillist.html

-Terence Bandoian


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message