Announcement Announcement Module
Collapse
No announcement yet.
Jasper Reports, generating temporary file --> test.java Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jasper Reports, generating temporary file --> test.java

    I’m trying to incorporate Jasper Reports with my current project, and I’m having some trouble using Spring’s Web MVC.

    Here’s what I’ve done so far:

    First I created my “test.jrxml” file using iReports. Copied this file into my “webapp/WEB-INF/” directory. I’ve created a class called “JasperReportsController” which extends “JasperReportsMultiFormatView”. I’m using Eclipse with a Tomcat plugin (4.1.x). I’ve followed the example from springs documentation, section 13.7.3. It seems that whenever I run Tomcat Server, that the “test.java”, temp file, is generated immediately. For some strange reason “test.java” is generated inside the following directory “C:\webarch\eclipse\test.java”, as opposed to my projects location “C:\webarch\projects\%my_project_name%”. This is causing there to be classpath issues, because it can’t seem to see any of the jasper reports library classes. The following is a console snippet of the error:

    C:\webarch\eclipse\test.java:4: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    C:\webarch\eclipse\test.java:5: package net.sf.jasperreports.engine.fill does not exist
    import net.sf.jasperreports.engine.fill.*;
    ^
    C:\webarch\eclipse\test.java:14: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    C:\webarch\eclipse\test.java:15: package net.sf.jasperreports.engine.data does not exist
    import net.sf.jasperreports.engine.data.*;
    ^
    C:\webarch\eclipse\test.java:21: cannot resolve symbol
    symbol : class JRCalculator
    location: class test
    public class test extends JRCalculator
    ^
    C:\webarch\eclipse\test.java:28: cannot resolve symbol
    symbol : class JRFillParameter
    location: class test
    private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null;
    ^
    C:\webarch\eclipse\test.java:29: cannot resolve symbol
    symbol : class JRFillParameter
    location: class test
    private JRFillParameter parameter_REPORT_CONNECTION = null;
    ^
    ………………………
    ………………………
    ………………………

    Are there any suggestions on how I can make this temporary file get generated at least within the projects directory?

  • #2
    Your controller shouldn't extends JasperReportsMultiFormatView - check out the sample app which can be obtained from CVS. You should also make sure that only version of JasperReports is on the classpath.

    Rob

    Comment


    • #3
      solution

      Rob thanks for replying. The example actually helped me out with some other issues. But I found out the reason why this file was being generated in the wrong directory. There's a file that the jasper reports library looks for called "jasperreports.properties". There was no documenation on this but you can set a couple of properties here, like the classpath of your referenced libraries and the location of where you wanted temp file to be generated.

      #jasper reports properties
      net.sf.jasperreports.compiler.temp.dir=....
      net.sf.jasperreports.compiler.classpath=....

      Comment

      Working...
      X