我正在尝试升级我的应用程序以使用BIRT 3.7.1版本。目前我使用的是2.6.0版本。
我正在使用最新的稳定版3.7.1。
在我的测试期间,我面临一个例外情况,报告使用的是序列号(RunningCount Aggregation)。当我将报表与Report Engine API一起使用时,如果我使用Web查看器报表工作正常,则会出现此异常。
我附上了一个小测试用例来重新创建问题。这包括报表设计文件和我在那里使用ReportEngine生成报表的类。
请在下面找到错误日志:
Jan 3, 2012 4:34:42 PM org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
SEVERE: An error happened while running the report. Cause:
java.lang.NullPointerException
at org.eclipse.birt.core.util.IOUtil.writeInt(IOUtil.java:226)
at org.eclipse.birt.core.util.IOUtil.writeObject(IOUtil.java:674)
at org.eclipse.birt.data.engine.executor.transform.SimpleGroupCalculator.next(SimpleGroupCalculator.java:233)
at org.eclipse.birt.data.engine.executor.transform.SimpleResultSet.next(SimpleResultSet.java:562)
at org.eclipse.birt.data.engine.executor.transform.ResultSetWrapper.next(ResultSetWrapper.java:81)
at org.eclipse.birt.data.engine.impl.ResultIterator.hasNextRow(ResultIterator.java:584)
at org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:525)
at org.eclipse.birt.data.engine.impl.ResultIterator.next(ResultIterator.java:475)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.next(QueryResultSet.java:191)
at org.eclipse.birt.report.engine.executor.ListingElementExecutor.hasNextChild(ListingElementExecutor.java:244)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:62)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at com.eclipse.birt.test.RunningCountFieldTest.main(RunningCountFieldTest.java:52)
Exception in thread "main" org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:196)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
at com.eclipse.birt.test.RunningCountFieldTest.main(RunningCountFieldTest.java:52)
Caused by: java.lang.NullPointerException
at org.eclipse.birt.core.util.IOUtil.writeInt(IOUtil.java:226)
at org.eclipse.birt.core.util.IOUtil.writeObject(IOUtil.java:674)
at org.eclipse.birt.data.engine.executor.transform.SimpleGroupCalculator.next(SimpleGroupCalculator.java:233)
at org.eclipse.birt.data.engine.executor.transform.SimpleResultSet.next(SimpleResultSet.java:562)
at org.eclipse.birt.data.engine.executor.transform.ResultSetWrapper.next(ResultSetWrapper.java:81)
at org.eclipse.birt.data.engine.impl.ResultIterator.hasNextRow(ResultIterator.java:584)
at org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:525)
at org.eclipse.birt.data.engine.impl.ResultIterator.next(ResultIterator.java:475)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.next(QueryResultSet.java:191)
at org.eclipse.birt.report.engine.executor.ListingElementExecutor.hasNextChild(ListingElementExecutor.java:244)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:86)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:62)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)
... 2 more
您可以在GitHub中找到重新创建问题的示例程序。
请帮我解决这个问题。
答案 0 :(得分:0)
我通过分离run
的{{1}}和render
任务来解决此问题。
而不是Report Engine API
分别运行IRunAndRenderTask task = engine.createRunAndRenderTask(design);
和IRunTask runTask = engine.createRunTask(design);
。