Jasper 报告中出现 NullPointerException?
当我使用 jasper 报告(版本 1.2.4)导出报告时,它会抛出 NPE。而且我在网上找不到任何解决该问题的方法。有人可以在这方面帮助我吗?
如果我删除报告中的一列有问题的列并将其导出,则它可以正常导出。无法找到该列的问题所在,因为它包含大量数据。
非常感谢!
将异常发布如下:
java.lang.NullPointerException|
at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|
at java.awt.font.TextMeasurer.initAll(Unknown Source)|
at java.awt.font.TextMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|
at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|
at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|
at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
When I export a report using jasper report (version 1.2.4), it throws NPE. And I cant find any solution to the problem online. Can anyone help me in this regard please?
If I remove one problematic column in my report and export it, it exports fine. Couldn't find whats the problem with that column as it contains large data.
Many Thanks in Advance !
Posting the exception below :
java.lang.NullPointerException|
at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|
at java.awt.font.TextMeasurer.initAll(Unknown Source)|
at java.awt.font.TextMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|
at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|
at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|
at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用纯 JRE 代码得到完全相同的错误,如下所示:
因此,我一直假设这是一个 JRE 错误并已将其提交给 Oracle。解决方法大概是剔除导致它的任何字符序列,但我显然不知道你在输入什么。
You can get the exact same error using pure JRE code, like this:
Because of this, I have been assuming it's a JRE bug and already submitted it to Oracle. The workaround is presumably to cull whatever character sequence is causing it, but I obviously don't know what you are feeding in.
这可能是 (1) 您正在使用的 JRE 版本中的错误,或 (2) 线程错误。在我从事的项目中,我们在堆栈跟踪中具有相同的前五行。
This is likely either (1) a bug in the version of the JRE you're using, or (2) a threading bug. We've had the same top five lines in stack traces in a project I work on.