Jump to content
Changes to the Jaspersoft community edition download ×

NullPointerException with iReports 1.2.0

2006 IR Open Dicussion

Recommended Posts

By: Doron Barak - doronbarak

NullPointerException with iReports 1.2.0

2006-03-01 08:41

First I'd like to thank you for a fine product! :)


I've been working for a bit with iReports 1.1.0, and everything was working properly. Today, as I loaded iReports, it told me of the new version, so I happily downloaded it.


My reports works the same when loaded and run from iReports itself, however, I have a Servlet that serves the report within a Web Application, and therein lies the problem.


I get the following:


Exception in thread "Thread-11" java.lang.NullPointerException

at java.util.Hashtable.put(Hashtable.java:396)

at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:558)

at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:847)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:672)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:632)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)

at test.Report.fillReport(Report.java:41)

at test.ReportServlet$3.run(ReportServlet.java:193)

at java.lang.Thread.run(Thread.java:595)


Where as my code to fill the report looks like this:


protected JasperPrint fillReport(JasperReport jr, Map parameters, Connection dbConnection) throws JRException {

return JasperFillManager.fillReport(jr, parameters, dbConnection);



I compile the JRXML files in memory and use them as JasperReport objects and it all works very well with iReports 1.1.0, and I have checked the parameters Hashtable that I supply to my fillReport method, it has everything the report needs to run.


As the report runs fine in iReports 1.2.0, I'm sure this must be something like an oversight on my part, I'm just lost as to exactly what that could be.


Thanks in advance,

Doron Barak





By: Doron Barak - doronbarak

RE: NullPointerException with iReports 1.2.0

2006-03-01 09:20

Upon further investigation, I've found that for some reason, JasperReports is trying to do the following:


Hashtable.put(REPORT_RESOURCE_BUNDLE, null)


Not sure why, but now I'll check what iReports 1.1.0 is trying to do in the same case! :)






By: Doron Barak - doronbarak

RE: NullPointerException with iReports 1.2.0

2006-03-01 09:27

Once I declared my parameters Hashtable like this:


reportParameters = new Hashtable() {

public Object put(Object key, Object value) {

return value != null ? super.put(key, value) : null;




Things seem to work now. This of course is a work around and JasperSoft should probably look into this, but thanks again for a great product that works!





By: Doron Barak - doronbarak

RE: NullPointerException with iReports 1.2.0

2006-03-01 10:14

Sorry for the mess, when using a HashMap for the parameters, the problem is resolved, please ignore/remove this whole thread as using a HashMap is actually recommended by Teodor:







By: Giulio Toffoli - gt78

RE: NullPointerException with iReports 1.2.0

2006-03-01 10:41

Hi Doron, this thread could be useful to other people. Thanks.







By: Doron Barak - doronbarak

RE: NullPointerException with iReports 1.2.0

2006-03-01 14:39

Glad to be of help :)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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