本文介绍了如何在Jaspersoft工作室插件中修复由TraceGovernor引起的java.lang.NullPointerException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Jaspersoft工作室编写插件。插件崩溃,当它试图打开预览的报告。 (从插件)java.lang.NullPoinpointerException的堆栈跟踪:

  com.jaspersoft.studio.debug.TraceGovernor.setup TraceGovernor.java:111)
com.jaspersoft.studio.debug.TraceGovernor.initMaps(TraceGovernor.java:118)
com.jaspersoft.studio.debug.TraceGovernor.beforeReportInit(TraceGovernor.java:162)
net.sf.jasperreports.engine.fill.JRFillDatasetScriptlet.beforeReportInit(JRFillDatasetScriptlet.java:74)
net.sf.jasperreports.engine.JRAbstractScriptlet.callBeforeReportInit(JRAbstractScriptlet.java:176)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:236)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
net。 sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580)
net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414)
net.sf. jasperreports.engine.fill.BaseFillHandle $ ReportFill.run(BaseFillHandle.java:119)
java.lang.Thread.run(Thread.java:745)

非代码堆栈跟踪是我的。我认为它不能加载必要的类。 (Jaspersoft工作室可以加载所有必需的库)有谁知道,该怎么办?非常感谢。






编辑



这是由Jaspersoft工作室中的此属性引起的,它加载了扩展名,即加载 TraceGovernor 。这是调试报告,但它与我的插件不兼容。

  net.sf.jasperreports.extension.registry .factory.governor = com.jaspersoft.studio.debug.TraceGovernorExtensionsRegistryFactory 

我已经解决了它从java包 com.jaspersoft.studio_6.3.0.final.jar\jasperreports_extension.properties ,但我想要一些非破坏性的方法,如何禁用此扩展。

解决方案

相关源代码可从以下网址获取:





NPE似乎是 TraceGovernor 中未初始化的 jrConfig / code> class,它将被初始化为 getJasperReportsContext()的 ScriptletFactoryContext上下文在构造函数 TraceGovernor 返回一个 instance of JasperReportsConfiguration 。



您可以结帐并浏览存储库,以进一步调查NPE的原因。否则,我只能建议使用JasperSoft提交错误报告。


I'm writing plugin for Jaspersoft studio up-to-date. The plugin crashes, when it is trying to open preview of report. (from the plugin) Stack Trace of java.lang.NullPoinpointerException:

com.jaspersoft.studio.debug.TraceGovernor.setup(TraceGovernor.java:111)
com.jaspersoft.studio.debug.TraceGovernor.initMaps(TraceGovernor.java:118)
com.jaspersoft.studio.debug.TraceGovernor.beforeReportInit(TraceGovernor.java:162)
net.sf.jasperreports.engine.fill.JRFillDatasetScriptlet.beforeReportInit(JRFillDatasetScriptlet.java:74)
net.sf.jasperreports.engine.JRAbstractScriptlet.callBeforeReportInit(JRAbstractScriptlet.java:176)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:236)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580)
net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414)
net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:119)
java.lang.Thread.run(Thread.java:745)

Non of code in stack trace is mine. I think it can't load necessary classes. (Jaspersoft studio can load all necessary libraries) Does anyone know, what to do with it please? Many thanks.


Edit

I've found, that it's caused by this property in Jaspersoft studio, that loads extension, that is loading TraceGovernor. It's for debugging report, but it isn't compatible with my plug-in.

net.sf.jasperreports.extension.registry.factory.governor=com.jaspersoft.studio.debug.TraceGovernorExtensionsRegistryFactory

I've solved that by removing it from java package com.jaspersoft.studio_6.3.0.final.jar\jasperreports_extension.properties, but I would like some non-destructive method, how to disable this extension.

解决方案

The relevant source code is available at:

http://anonsvn:[email protected]/svn/repos/jaspersoftstudio/tags/6_3_0_final/com.jaspersoft.studio/src/com/jaspersoft/studio/debug/TraceGovernor.java

The NPE appears to be the result of an uninitialized jrConfig field in the TraceGovernor class, which would be initialized had getJasperReportsContext() of the ScriptletFactoryContext context in the constructor of TraceGovernor returned an instanceof JasperReportsConfiguration.

You may checkout and navigate the repository to further investigate the reason for the NPE. Otherwise, I can only suggest to file a bug report with JasperSoft.

这篇关于如何在Jaspersoft工作室插件中修复由TraceGovernor引起的java.lang.NullPointerException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 05:24