The World’s Largest Online Community for Developers

'; How to solve this nullPointer Exception in jasper report? - LavOzs.Com

I am new to jasper report, I need to create pdf document with BeanDatasource and subreport. I refer the following blog " " . I followed all the steps perfectly. While i am running the report using IReport i can get the pdf document with the content. But when we try to create from java program i m getting exception in the following line

Line number 110: " JasperFillManager.fillReportToFile("C:/JasperReports/contacts.jasper", parameters, new JRBeanCollectionDataSource(TestPerson.getBeanCollection())); "

and this is the following error i am getting in my Eclipse Console window .

java.lang.NullPointerException at net.sf.jasperreports.engine.JRPropertiesMap.readObject( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at Source) at net.sf.jasperreports.engine.util.JRLoader.loadObject( at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation( at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport( at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate( at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate( at net.sf.jasperreports.engine.fill.JRFillBand.evaluate( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport( at net.sf.jasperreports.engine.fill.JRBaseFiller.fill( at net.sf.jasperreports.engine.fill.JRBaseFiller.fill( at net.sf.jasperreports.engine.fill.JRFiller.fillReport( at net.sf.jasperreports.engine.JasperFillManager.fillReport( at test.TestJasperReport.main(

I had a similar problem and found that iReports had had an auto update and that the files it produces were no longer compatible with the version of Jasper being brought into the build of my application.

I resolved this by ensuring that I had downloaded the very latest iReports and the very latest Jasper Reports.

iReport v3.7.4 and Jasper Reports v3.7.4.

It looks like on of the properties you are passing to your report is null.

I would suggest stepping through your code in debug.

Subreports in Jasper Reports
Jasper sub report error
Jasper reports: getting errors of class not found
Jasper Reports Breaks on Build (no edits)
JasperReports API: getting error when calling report view method by different jar
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