空'键'参数错误 [英] Null 'key' argument error

查看:122
本文介绍了空'键'参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用IReport 3.5.0和我的java GWT应用程序使用编译的.jasper文件,创建一个报告。我在java应用程序中创建数据源,并使用 fillReport()方法来填充报告。它工作正常,它填充了我在.jrxml和Java应用程序中定义的字段。

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.

但是,我想使用这些字段来创建饼图,它不工作。我给我的工作字段作为图表的键和值表达式,但当我运行应用程序,它给出错误 java.lang.IllegalArgumentException:Null'key'参数。我不能解决它,即使我给 $ V {PAGE_COUNT} 作为键表达式,它总是给出相同的'null key'错误。我被卡住了。感谢您的帮助。

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.

推荐答案

我有同样的问题。基本上,JasperReport中的饼图讨厌空对象。错误消息不会帮助太多...

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!

如果您可以在IDE中运行应用程序,请在IllegalArgumentException上放置断点。它将帮助您找到根本原因。还要确保报告每次进行更改时重新编译jrxml。

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!

顺便说一句,这与GWT无关,因为这一切都在服务器上运行。

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

这篇关于空'键'参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆