The World’s Largest Online Community for Developers

'; java - Jasper Reports Breaks on Build (no edits) - LavOzs.Com

I inherited a project from a developer that left the company. The project is in java (new to me) and uses jasper reports (new to me) to generate a PDF. I need to update one of the reports to remove some text. If I get the code out of source control and just run it it works fine. But if I open one of the jrxml files and build it making no changes then try to run the report again it breaks. The error I'm getting is:

java.lang.NullPointerException java.lang.Class.isAssignableFrom(Native Method) net.sf.jasperreports.engine.fill.JRFillTextField.getFormat( net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText( net.sf.jasperreports.engine.fill.JRFillTextField.evaluate( net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate( net.sf.jasperreports.engine.fill.JRFillBand.evaluate( net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand( net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail( net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart( net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport( net.sf.jasperreports.engine.fill.JRBaseFiller.fill( net.sf.jasperreports.engine.fill.JRBaseFiller.fill( net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport( Source)

I can't for the life of me figure out what the error means or how to debug it. As I said above I made no changes to the actual report. All I did at this time was open the jrxml file in iReport and build it. If I revert the jasper file to the version that was checked in then the report starts working again. This report has some sub reports and it doesn't seem to matter which file I build any one will break the whole report.

I don't know if it helps but I debugged the code and the line it's dying on reads:

bytes = JasperRunManager.runReportToPdf(...)

EDIT: My jasper report JAR and my iReport version were different versions. I added the JAR for the version of iRpeort I'm using (5.1.0) and I'm getting a new error now. Progress! The error is:

cannot assign instance of net.sf.jasperreports.engine.base.JRBaseTextField to field net.sf.jasperreports.engine.base.JRBaseParagraph.paragraphContainer of type net.sf.jasperreports.engine.JRParagraphContainer in instance of net.sf.jasperreports.engine.base.JRBaseParagraph

Thanks for the help commenters. I just went and got iReport v4.0.1 to match the Jar I had. Now I can edit the files. Unfortunately I don't have the time to go and learn all this from scratch so I'll just sick with the older version for now.

Some features in the library changed going from 4 to 5, and it takes some tweaking to get the reports to work. One major change is with barcodes, how iReport includes them, and what library they are backed with. Because you are not familiar with java or JasperReports, I think that getting the older version of iReport was the right move.

In the future, know that it is possible to pack your JAR with the jrxml files instead of the compiled jasper files, and have the library compile the reports on the fly. This makes maintenance much less of a nightmare I have found.

How to solve this nullPointer Exception in jasper report?
iReport font not available to JVM net.sf.jasperreports.awt.ignore.missing.font=true has no effect.
Jasper sub report error
Jasper reports: getting errors of class not found
Jasper reports List as Parameter
JasperReport: How to get date from the "oracle.sql.TIMESTAMP' field?
An error has occurred. Please contact your system administrator. (6632) error in Jasper server 6.2
Barcode creation in Jasper report: n is not a valid character for Standard 2 of 5 encoding
Call Jasper subreports in java