I am a new comer to web application development in java and I am using net beans for this .
I am created a web application to print a jasper report in client side.I used a servlet for this purpose. In here I gained above problem . I gave file path in different ways . But finally I have to put file path with the current working directory(partition) . But I want to give it with the path of the src folder .
Also I've gave this path with the project name . But I had gain following exception .
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: Jasper\JasperReport\src\java\jasper\Report.jrxml (The system cannot find the path specified)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:222)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:193)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:184)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:224)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:539)
at jasper.Show.processRequest(Show.java:61)
at jasper.Show.doGet(Show.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: Jasper\JasperReport\src\java\jasper\Report.jrxml (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:217)
... 28 more
Jasper\JasperReport\src\java\jasper\Report.jrxml
- List item
It would be easier to help you if you pasted fragment of your code. But I'll try anyway.
Method
JasperCompileManager.compileReportToFile
takes as an argument a path to jrxml file, either absoulute or relative to working directory. And I think you shouldn't use that method in this case.In your case I think it would be better to use something like this:
(I've omitted here any exception handling or resources closing)