francesco334 Posted September 11, 2007 Share Posted September 11, 2007 Hello, I've a strange problem when I call my iReport app, from my java code. This is the code: "String reportFileName= this.URL_JASPERFILES + "mail/AirServices.jasper"; String outFileName = url+"/" + sPnrBasket + "_operativo" + ".txt"; this.logger.debug("RenderDocumentRQ WS: nome reportFileName: " + reportFileName); JRXMLDataSource jrxmlds = new JRXMLDataSource(xmlFileName,recordPath); HashMap hm = new HashMap(); Connection conn = getConnection(); hm.put("subreportDS",conn);hm.put("SUBREPORT_DIR", this.URL_JASPERFILES + "mail/");this.logger.debug("RenderDocumentRQ WS: setto parametri connesione SUBREPORT_DIR: " + this.URL_JASPERFILES + "mail/"); try{JasperPrint print = JasperFillManager.fillReport( reportFileName, hm, jrxmlds);..." I have Tomcat installed on d: partition on my pc, and when I run the app I have: "16:07:54,560 DEBUG otalogger:2401 - RenderDocumentRQ WS: nome reportFileName: D:Tomcat 5.5webappsDocumentBookServiceWEB-INFclassesReportmail/AirServices.jasperjava.net.MalformedURLException: unknown protocol: d at java.net.URL.<init>(Unknown Source) at java.net.URL.<init>(Unknown Source) at java.net.URL.<init>(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at it.businesslogic.ireport.connection.JRXMLDataSource.<init>(JRXMLDataSource.java:30) at it.eminds.ws.report.DocumentBookServiceWs.mailBasket(DocumentBookServiceWs.java:2403) at it.eminds.ws.report.DocumentBookServiceWs.RenderDocumentRQ(DocumentBookServiceWs.java:302) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388) at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) at java.lang.Thread.run(Unknown Source)" If I change the path of my xml file (to pass to iReport) in c:(mydir) .. all works! Can u helpme? Thanks & Regards,Francesco Link to comment Share on other sites More sharing options...
csbac Posted September 11, 2007 Share Posted September 11, 2007 Hi!Obviously, d:/your/path gets interpreted as an URL, while c:/some/path is not ... According to the documentation, http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/data/JRXmlDataSource.html JRXmlDataSource(java.lang.String uri)you have to give a URI to the constructor, not a file name (file:///c:/some/path).So the bug is in reality that it works with c: while it shouldn't ... or, I rather believe you use / in one of the paths, and \ [backslash] in the other Alternatively, usenew JRXmlDataSource(new File("d:/some/path")); Hope this helps,Sebastian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now