Jump to content
Changes to the Jaspersoft community edition download ×

Calling a subreport in from java 6.3.0


lbalding_1

Recommended Posts

I'm pretty familar with the product and am able to run other reports from java with no problems.  Works well.  I am, however, not able to run a report that contains subreports.  I found solutions on stackoverflow but still am unable to make it work.  In my solution, I am loading the reports into a table for storage and pulling the subreportsand main report from the database and compiling the jrxml.  Everything works fine up to there and then

 

net.sf.jasperreports.engine.JRException: Resource not found at: subInvoiceSummary.jasper.
ERROR in runReport:Resource not found at: subInvoiceSummary.jasper.
at net.sf.jasperreports.repo.RepositoryUtil.getResourceFromLocation(RepositoryUtil.java:153)
at net.sf.jasperreports.repo.RepositoryUtil.getReport(RepositoryUtil.java:112)
at net.sf.jasperreports.engine.fill.JRFillSubreport.loadReport(JRFillSubreport.java:398)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:365)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:427)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:341)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2022)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)
 
I've tried a lot of permutations but to no avail.  I tried also to pull in the code for jasperreports to trace the the stace shown above but there are so many .jar dependencies and versions of dependencies I could not get it to compile clean in my project (if anyone has a link to a simple method to make that would please let me know).  Here is the code snippet:
 
 
Map<String, Object> rptParms = new HashMap<String, Object>();
 
List<daRecOnDemandSubReport> subReports = report.getOnDemandSubReport();
Iterator<daRecOnDemandSubReport> subReportList = subReports.iterator();
while (subReportList.hasNext()) {
daRecOnDemandSubReport subReport = subReportList.next();
ByteArrayInputStream x = getSubReportDataStream(dbConnROIPro, report.getODReportID());
JasperReport compiledSubReport = JasperCompileManager.compileReport(x);
String fileName = subReport.getODSubReportFileName().replace(".jrxml", ".jasper");
rptParms.put(fileName, compiledSubReport);
}
 
ByteArrayInputStream x = getReportDataStream(dbConnROIPro, report.getODReportID());
 
JasperReport cRpt = JasperCompileManager.compileReport(x);
 
rptParms = getReportParameters(dbConnGTrack,report.getODReportID(), rptParms, report.getOnDemandParm(), programID);
 
JasperPrint rpt = JasperFillManager.fillReport(cRpt,rptParms,dbConnGTrack.getDbConn());
 
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
JRXlsxExporter XLSXexporter = new JRXlsxExporter();
   XLSXexporter.setExporterInput(new SimpleExporterInput(rpt));
   XLSXexporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outStream)); 
   XLSXexporter.exportReport();
 
Thanks in advance for any assistance

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...