Jump to content
We've recently updated our Privacy Statement, available here ×

he system cannot find the path specified


manjesh

Recommended Posts

Hi,

I am trying to compile a JRXML file to a .jasper file inside my webapp(here: MyWebApp) sitting inside an EAR file. I am trying the following API.

 

JasperCompileManager.compileReportToFile(

"MyWebApp/jasper/sampleReport.jrxml",

"MyWebApp/jasper/sampleReport.jasper");

 

but for whatever reason I keep getting the error message saying

11:43:35,843 ERROR [sTDERR] net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: MyWebAppjaspersampleReport.jrxml (The system cannot find the path specified)

11:43:35,843 ERROR [sTDERR] at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)

11:43:35,843 ERROR [sTDERR] at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:152)

11:43:35,843 ERROR [sTDERR] at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108)

11:43:35,843 ERROR [sTDERR] at edu.utsouthwestern.jee5projweb.action.JasperReportsAction.execute(JasperReportsAction.java:40)

11:43:35,843 ERROR [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

11:43:35,843 ERROR [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 

[/quote

 

any idea how to get around this problem?

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You need to specify to the jasper classpath where your file is located so try this one and see if it is working...

 

System.setProperty("jasper.reports.compile.class.path",context.getRealPath("/WEB-INF/lib/jasperreports-1.3.4.jar")+ System.getProperty("path.separator")+ context.getRealPath("/WEB-INF/classes/"));

//Specify a default folder for storing

//compiled XML templates

System.setProperty("jasper.reports.compile.temp",context.getRealPath("/reports/"));

In this example I have placed my jrxml files in the reports directory. Execute these statements before compiling and it will work.

Link to comment
Share on other sites

Euhm, I think you are making it a bit too difficult.

His path to his .jrxml file just seems to be incorrect.

Just try to put to complete path to test it, so instead of "MyWebApp/jasper/sampleReport.jrxml" type: c:/.../.../.../.../sapleReport.jrxml

(if you want to make the path more dynamical you can use: String path=context.getRealPath("/WEB-INF/path_to_reportmap"); like lukkumar said. than the string path will be: c:/your path to your webapp/WEB-INF/path_to_reportmap)

Post edited by: giroe, at: 2007/07/30 10:21

Link to comment
Share on other sites

Hi,

 

First of all, you should make sure you need to compile report templates at runtime.

Since you've put the JRXML file in an EAR file, it is obvious you don't need to compile report templates at runtime.

Your JRXML is static. It does not change at runtime. So why don't you compile it when you build your EAR and put only the compiler *.jasper file there????

Only when we deal with dynamic report templates (templates change at runtime) we need to compile them.

 

And even if you do need to compile JRXML at runtime, you have to make sure you can locate the file on disk. This is not related to JasperReports whatsoever. It is a FileNotFound exception in your case.

Note that you don't need to configure any system property in order to compile report templates. You only need to make sure that the jdt-compiler.jar file is in the classpath of your application. You can find it in the /lib directory of the JasperReports project distribution.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...