Transfer email and migrate accounts with YippieMove.
Home > Programming > Using subreports in Jasper iReport

Using subreports in Jasper iReport

October 20th, 2006

When trying to create a subreport in Jasper, I kept receiving the following error:

net.sf.jasperreports.engine.JRException: Could not load object from location

every time I tried to generate a sample PDF file. The subreport has its own SQL statement and needs to select data based on an id number passed as a parameter from the main report, so for the longest time I thought I was passing the parameter wrong.

Turns out that the real problem was in order to make a subreport work it has to be compiled. I had it compiled, but the compiled version of the resport (ending in .jasper) was being saved in a different folder. I didn’t know it was .jasper so I tried to specify every possible path to the .jrxml file which did not work.

So for anyone experiencing this problem, here’s what to do:

  1. Compile the subreport.
  2. Find the compiled .jasper file.
  3. Make sure your main report is referencing this .jasper file and nothing else.
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Slashdot
  • StumbleUpon

siker Programming

  1. shubha
    May 26th, 2009 at 09:53 | #1

    which folder is jasper file available, i ran a search but was unable to find it

  2. May 30th, 2009 at 21:56 | #2

    If you can’t find the .jasper file you probably didn’t compile the report yet. Hit the compile button in iReport – it looks like a gear. Also check the messages and make sure the report doesn’t have an error that prevents compilation.

  1. No trackbacks yet.