tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chen Yang <cy...@hrsg.ca>
Subject RE: The resource path [...] is not valid
Date Fri, 02 Oct 2015 15:28:50 GMT
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
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWDp0yAAoJEBzwKT+lPKRYwosQAJEk7lm9azal0bUXbP4ffZiN
Ff+b+CfqM8ZgIaKOjSnS2cLObgaPAYhtuy+1q98cZ3B5VjvYWRADxrZNPvmqYXYp
ZZqJSYpkvoHU6L81E5gU3WtBYakm1M7MWCdkGoPz6ygngsOLA0MeWj20ef22Dnj2
2ygGTBDdokwK7a4fYi2yYq80ZLjvvRvrxAqP+SFhpdydWcrnWMIdxMxgCFc1JoJx
waMp++c1DYBA2UwanTsjlo4+BFE1EhcTGd9p27hLJq0HciNSAB3fYve9cFUExHO/
7b4zoSaWhZ4gsI8MjMUibtV53hOE2hL8z8KQOzONxm/auRAH4j9x6AcpF5AyIo/t
lFXYESzYh85N0VI4U3tDbl5YIgFkgx3ua+TfTV0j/LWJPK5CcNc86PFuip3JRZLN
VblWWmBa5+/KNDgl3DktURjVlrvLJ0wmN6dastBAuEhvU6Y7YKfV898SgDNQQBYH
/TYTZidNi+xIM+62UYfFZOLRXiAO8XP1J6NrbmKRJCFy8z9ro23erXIDJHSgMROH
eoJ1qQ3ureqysdWxLAzTAAlP+kRtldUM5Ii2fIV2uc6tLpazESr0kgxT3K1XhHjc
ZLu2gARzg4Akn/dl2dlm0TgSc+5+f2s+ykbZ7crwrEabYppnBCJCn3T7ucrO4kgC
ksiIdogyhYE+uInftDEa
=+K3y
-----END PGP SIGNATURE-----

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


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

Mime
View raw message