junaed Posted December 6, 2009 Share Posted December 6, 2009 Hello, I have been using jasper report for a while. Right now I am stuck using the JRDataSource. I have created a report (attached). If i generate this using a direct connection to the database, it works perfectly. But if I try to generate it using a custom JRDataSource(attached), I get heap overflow error. The database query returns exactly one row. But I have found that when I am using the datasource, there are infinite calls to getFieldValue() for the same field. I have attached necessary files here:1. TestDataSource.java : my custom JRDataSource implementation.2. PIRequest2.jrxml: the report.Any help is highly appreciated. Thank you.I am using the following code to generate the report:Code:String reportPath = "/report/PIRequest2.jrxml"; TestDataSource ds = getPIRequestReportDataset(this.pIRequestDetail.getIdNr()); System.out.println("got ds"); JasperDesign jasperDesign = JRXmlLoader.load(this.getClass().getResourceAsStream(reportPath)); System.out.println("jasper design created"); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);// JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportPath); System.out.println("jasper report created"); Map parameters = new HashMap(); parameters.put("pi_request_id", this.pIRequestDetail.getIdNr().longValue()); System.out.println("creating jasper print..."); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds); System.out.println("before view.."); JasperViewer.viewReport(jasperPrint, false); Link to comment Share on other sites More sharing options...
junaed Posted December 6, 2009 Author Share Posted December 6, 2009 Oh I have solved my problem. It was created in the next() method in the custom data source. Since I was acquiring the iterator everytime, I was at the head of the list on eash request.Thank you all. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now