0

I have a strange problem. I have a report with huge data. When I request the report by specific date or short range date, the report shows normally, but when I request a report by large range this exception throws: java.util.NoSuchElementException

I think maybe was the Datasource (XML), but when I change the datasource to JSON, the problem still happens. Any ideas?

PD: When I run the report on iReport everything it's OK. :(

JasperReports version is 5.6.0
Java JDK 7

The complete exception:

java.util.NoSuchElementException at java.util.AbstractList$Itr.next(Unknown Source) at net.sf.jasperreports.engine.fill.JRPrintBand$ElementsIterator.next(JRPrintBand.java:151) at net.sf.jasperreports.engine.fill.JRPrintBand$ElementsIterator.next(JRPrintBand.java:1) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBand(JRVerticalFiller.java:2136) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2090) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:788) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:298) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:892) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:114) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:584) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:930) at ibusplus.com.reportRequest.clases.ReportExport.getJasperPrint(ReportExport.java:208) at ibusplus.com.reportRequest.clases.ReportExport.getJasperPrint(ReportExport.java:192) at ibusplus.com.reportRequest.clases.ReportExport.getURLReport(ReportExport.java:274) at org.apache.jsp.reportGenerator_jsp._jspService(reportGenerator_jsp.java:151) 

1 Answer 1

1

I really wish I could ask you some questions, but my low reputation score prevents that. But since it has been 2 hours and you've received no response, I'll risk offending other members and offer this:

It is likely that there is some malformed XML that only gets read when you process the "huge" file. In all your runs of small files (or small portions of the large file) you've been fortunate enough not to encounter the bad data. I would do one of the following (or all):

  1. Divide and conquer. Process only the first half of the huge file. If that succeeds, process only the second half of the huge file. Presumably that will fail. Then divide this second half in two as before. Eventually you'll narrow down the small chunk of huge data that is malformed. Once you find this, check the entire file for similar occurrences.

  2. If there is a DTD or XSD that describes the XML, I would validate the entire XML file against this DTD or XSD entirely outside of any Jasper code or process. Use a standalone, SAX based, validator.

  3. If there is no DTD or XSD, then I'd use an XSD generation tool and generate an XSD (you can use Microsoft's XSD.exe which is included in their Windows OSes -- just look for it). This will generate an XSD from the actual XML. Once you have the XSD, look it over and see if there are any unexpected elements. E.g. you may have an element named Invoices that you are familiar with. If you see an element definition for Invioces (switched i and o) you'll likely have found the culprit.

  4. Also, see Data Source from string. In this post I suggest a wrapper around the Datasource object so that you can see what Jasper is retrieving in real time.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you for your response. Well I realize when I remove any field of the detail band, the report show with no problems :S that confuse me more, because maybe exist a limit of fields on the detail band :(
You know something about jasper reports, I really need help with that. Thanks again for your response. I will try to put in practice
Perhaps the exception relates to your .jrxml file and not the huge XML file that is the input to the report? Maybe the report definition refers to an element within the report definition that is missing (or not spelled the same).
And you think that throws java.util.NoSuchElementException? Because that raise when there is no next element on the iterator. I validated the xml file input and everything is OK. I have no idea what is happened
Well, no. Upon closer inspection of your stack, I think that was a misdirected suggestion on my part. I see from the stack that the report is produced as part of a web call and you mentioned that the report works fine when run from iReports. That's a clue, as the code is different (although some of the code may be common). Are the Jasper libs that Apache is calling the same version as the libs iReports uses? Are you using the most recent versions of the libs anywhere? If Apache has older libs, try replacing them with the latest.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.