Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
NullPointerException BIRT 2.6.2
snmadhav
Hi,<br />
<br />
We are running into a NullPointerException issue when running a certain report. This is happening only on Windows 7 and is working fine on AIX platform.<br />
<br />
We tried it on multiple Windows machines and the first few times the report renders fine without errors. But after that we see messages written into org.eclipse.birt.chart.engine_XXXX.log file as below for the same report.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SEVERE: ChartReportItemPresentationImpl: onRowSets(...) - failed
Nov 16, 2012 9:58:29 PM org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase onRowSets
WARNING: Exception
java.lang.NullPointerException
at org.mozilla.javascript.UintMap.rehashTable(UintMap.java:295)
at org.mozilla.javascript.UintMap.ensureIndex(UintMap.java:360)
at org.mozilla.javascript.UintMap.put(UintMap.java:160)
at org.mozilla.classfile.ConstantPool.addConstant(ClassFileWriter.java:2794)
at org.mozilla.classfile.ClassFileWriter.addLoadConstant(ClassFileWriter.java:668)
at org.mozilla.classfile.ClassFileWriter.addPush(ClassFileWriter.java:927)
at org.mozilla.javascript.optimizer.Codegen.generateNativeFunctionOverrides(Codegen.java:840)
at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:313)
at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
at org.mozilla.javascript.Context.compileImpl(Context.java:2391)
at org.mozilla.javascript.Context.compileString(Context.java:1359)
at org.mozilla.javascript.Context.compileString(Context.java:1348)
at org.mozilla.javascript.Context.evaluateString(Context.java:1101)
at org.eclipse.birt.chart.script.AbstractScriptHandler.register(AbstractScriptHandler.java:673)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.initializeScriptHandler(ChartReportItemPresentationBase.java:996)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.onRowSets(ChartReportItemPresentationBase.java:834)
at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationProxy.onRowSets(ChartReportItemPresentationProxy.java:108)</pre>
<br />
Couldn't find any known issues on the forum and on the net for <br />
<em class='bbc'>java.lang.NullPointerException at org.mozilla.javascript.UintMap.rehashTable</em><br />
<br />
Any suggestion on what could be causing it? After the exceptions, no report is working.<br />
<br />
Thanks & Regards,<br />
Madhav
Find more posts tagged with
Comments
mwilliams
Are you doing any scripting on the chart? Can you attach your report?
snmadhav
Hi Michael,<br />
<br />
i) Unfortunately the file is around 11MB and I'm not able to upload it onto the forum. Let me try to create a scaled down version where the issue can be recreated. There are 30 other reports in our environment and the issue isn't happening on them. The others are smaller ones around 2-6MB (rptdesign file size).<br />
<br />
ii) The only user-defined script on the charts is "onRender"<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function beforeDrawAxisLabel( axis, label, icsc )
{
var rpCtx = icsc.getExternalContext().getScriptable();
if (rpCtx.getLocale()=="zh_CN" || rpCtx.getLocale()=="zh_TW" || rpCtx.getLocale()=="ja" ||
rpCtx.getLocale()=="ko")
label.getCaption().getFont().setName("Katakana");
}</pre>
<br />
iii) The report runs fine for the first few times and then BIRT engine crashes and no report can then be generated. The other change in our environment is the move from JDK 1.6 to JDK 1.7. On the 1.6 environment, the report was executed 10-15 continuously and in parallel without an issue.<br />
<br />
Thanks & Regards,<br />
Madhav
snmadhav
We found that depending on the size and complexity of the report, the issue occurs for all the reports in our environment. Complex report fail early and simple ones take some number of executions before failing.
Thanks & Regards,
Madhav
mwilliams
I've heard of several issues using java 1.7 rather than 1.6. This may be related to that.
snmadhav
Hi Michael,<br />
<br />
Since the exception stacktrace was pointing to the org.mozilla.javascript plugin, we were trying various things and found that there could be a race condition. And also the exception was happening elsewhere in the code and not where the stacktrace was pointing to. In UintMap.java, at line 273, when we introduced a delay:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>try {
Thread.sleep(0);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}</pre>
<br />
the crash wasn't happening. Not sure if the above change we made is a valid one or not, but BIRT hasn't crashed in over 3 hours period we tested by generating hundreds of reports. The downside is the delay in report generation process.<br />
<br />
<br />
It was also observed that when the crash happened, it was always during the rendering phase. Though the org.mozilla.javascript plugin seems to be called during the run phase as well, it never crashed then. The comments in the original Rhino source code downloaded from <a class='bbc_url' href='
https://developer.mozilla.org/en-US/docs/Rhino/Downloads_archive?redirectlocale=en-US&redirectslug=Rhino_downloads_archive'>https://developer.mozilla.org/en-US/docs/Rhino/Downloads_archive?redirectlocale=en-US&redirectslug=Rhino_downloads_archive</a>
; , has <br />
<blockquote class='ipsBlockquote' ><p>/**<br />
* Map to associate non-negative integers to objects or integers.<br />
* The map does not synchronize any of its operation, so either use<br />
* it from a single thread or do own synchronization or perform all mutation<br />
* operations on one thread before passing the map to others.<br />
*<br />
*
@author
Igor Bukanov<br />
*<br />
*/</p></blockquote>
<br />
So we tried making the class and methods "synchronized", but that didn't help. As suggested in best practices, we create only one BIRT engine when server starts our application and get instances of this engine for each report execution. So there are multiple "threads" which could be running. Not sure how BIRT handles these requests and how it makes use of the org.mozilla.javascript plugin. So we tried adding the sleep, and there was no error.<br />
<br />
Thanks & Regards,<br />
Madhav
snmadhav
We added the following jvm option when starting the server which also solved the problem:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>-Xjit:exclude={org/mozilla/javascript/UintMap.rehashTable*}</pre>