views:

216

answers:

0

I'm trying to integrate Struts2 with JasperReports (don't run away - this is not the problem :) )

I have a jrxml file which needs to be put in WEBAPP_FOLDER/jasper. In my action i need to create a jasper file based on the jrxml file from that location:

 JasperCompileManager.compileReportToFile(
                    "jasper/our_jasper_template.jrxml",
                    "jasper/our_compiled_template.jasper");

But when I run the application, I get an exception:

    net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: 

`jasper\our_jasper_template.jrxml (The system cannot find the path specified)`

After some time, I found that the place where is looking is *c:...\apache-tomcat-6.0.20\bin*. So I copied the jasper folder(with the jrxml file too) in the bin folder.

I hit the refresh button, but I got this problem:

Error building report for uri D:\Projects\Hello_World_Struts2_Mvn\target\Hello_World_Struts2_Mvn\jasper\our_compiled_template.jasper

net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: D:\Projects\Hello_World_Struts2_Mvn\target\Hello_World_Struts2_Mvn\jasper\our_compiled_template.jasper

Caused by: java.io.FileNotFoundException: D:\Projects\Hello_World_Struts2_Mvn\target\Hello_World_Struts2_Mvn\jasper\our_compiled_template.jasper

I copied the jasper file from the tomcat/bin/jasper to *D:\Projects\Hello_World_Struts2_Mvn\target\Hello_World_Struts2_Mvn\jasper* and it's working.

The question: How can I make this work as it should work?