Null 'key' argument error

Halo picture Halo · Aug 10, 2010 · Viewed 10.8k times · Source

I'm using IReport 3.5.0 and my java GWT application uses the compiled .jasper file, to create a report. I'm creating the datasource in the java application and use fillReport() method to fill the report. It works fine, it fills the fields that I have defined both in the .jrxml and Java application.

However, I want to use those fields to create a pie chart, and it doesn't work. I give my working fields as key and value expressions for the chart, but when I run the application, it gives the error java.lang.IllegalArgumentException: Null 'key' argument. I couldn't solve it, even when I give $V{PAGE_COUNT} as key expression, it always give the same 'null key' error. I'm stuck. Thanks for any help.

Answer

Thierry-Dimitri Roy picture Thierry-Dimitri Roy · Aug 18, 2010

I had the same kind of issue. Basically the Pie Chart in JasperReport hates null object. The error message doesn't help very much...

Since you have already check for the key expression, check every other elements. My error was in a label expression!

If you can run your application in a IDE, put a breakpoint on "IllegalArgumentException". It will help you find the root cause. Also make sure the report recompile the jrxml every time you make a change.

Another approach would be to start with an example and modify it to fit your need little by little. You will find the culprit soon enough!

By the way, this has nothing to do with GWT since this all run on the server.