How can I fix java.lang.NullPointerException caused by TraceGovernor in Jaspersoft studio plugin?

折月煮酒 提交于 2019-12-23 18:52:42

问题


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.


回答1:


The relevant source code is available at:

http://anonsvn:anonsvn@code.jaspersoft.com/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.



来源:https://stackoverflow.com/questions/38511505/how-can-i-fix-java-lang-nullpointerexception-caused-by-tracegovernor-in-jasperso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!