question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange error "Can not retrieve data to generate the report"

See original GitHub issue

I’m upgrading an old RCP application from Java 8 to Java 11 and as part of that, I’m upgrading the BIRT update site of https://download.eclipse.org/birt/update-site/2018-09-interim/ to https://download.eclipse.org/birt/update-site/4.9.0/

A feature of the app is using BIRT to generate HTML reports. What’s really strange is that when I run the app from within Eclipse, this works fine, but when I build it using Tycho and Maven and launch from there, the report is basically blank and has these sorts of exceptions (despite the error suggesting there is no data available, the application GUI shows plenty of data):

org.eclipse.birt.report.engine.api.EngineException: There is an error in the report query loading, Can not retrieve data to generate the report.
Table (id = 288):
- There is an error in the report query loading, Can not retrieve data to generate the report. 

Error.ReportQueryLoadingError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There is an error in the report query loading, Can not retrieve data to generate the report. 
	at org.eclipse.birt.report.engine.data.dte.DataPresentationEngine.doExecuteQuery(DataPresentationEngine.java:121)
	at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:254)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1632)
	at org.eclipse.birt.report.engine.internal.document.v4.ReportItemExecutor.executeQuery(ReportItemExecutor.java:369)
	at org.eclipse.birt.report.engine.internal.document.v4.TableItemExecutor.doExecute(TableItemExecutor.java:68)
	at org.eclipse.birt.report.engine.internal.document.v4.ReportItemExecutor.execute(ReportItemExecutor.java:270)
	at org.eclipse.birt.report.engine.internal.document.v4.ContainerExecutor.prepareChildExecutor(ContainerExecutor.java:200)
	at org.eclipse.birt.report.engine.internal.document.v4.ContainerExecutor.hasNextChild(ContainerExecutor.java:108)
	at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:84)
	at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.hasNextChild(WrappedReportItemExecutor.java:84)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:60)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:97)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:136)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:66)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:27)
	at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:54)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:133)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:66)
	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:97)
	at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:569)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:273)
	at com.ibm.perf.ui.editor.ReportEditor.generateHTML(ReportEditor.java:153)
	at com.ibm.perf.ui.editor.ReportEditor.runReport(ReportEditor.java:109)
	at com.ibm.perf.ui.Controller$8$1.run(Controller.java:792)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4345)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3968)
	at com.ibm.perf.ui.ImageProgress.run(ImageProgress.java:111)
	at com.ibm.perf.ui.ImageProgress.start(ImageProgress.java:73)
	at com.ibm.perf.ui.Controller.OpenReportPage(Controller.java:809)
	at com.ibm.perf.ui.handlers.OpenReportPageHandler.execute(OpenReportPageHandler.java:13)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4604)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4390)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3966)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at com.ibm.perf.ui.Application.start(Application.java:43)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

There are no obvious differences or exceptions in the System.out/System.err of the two executions leading up to the report generation.

Comparing the installed plugins shows very minor differences (red is the failing app and green is the working app):

$ diff fails_plugins.txt works_plugins.txt 
8c8
< com.ibm.ptt.plugin (0.1.0.202206291830) "Bundle" [Active]
---
> com.ibm.ptt.plugin (0.1.0.qualifier) "Bundle" [Active]
33c33
< org.apache.batik.dom.birt.ext (1.14.0.v202203150031) "Batik DOM Extension" [Resolved]
---
> org.apache.batik.dom.birt.ext (1.14.0.v202203150031) "Batik DOM Extension" [Installed]
35d34
< org.apache.batik.ext (1.14.0.v20210324-0332) "org.apache.xmlgraphics:batik-ext" [Resolved]
77c76
< org.eclipse.birt.data.aggregation (4.9.0.v202203150031) "Build-in Aggregation Plug-in" [Starting]
---
> org.eclipse.birt.data.aggregation (4.9.0.v202203150031) "Build-in Aggregation Plug-in" [Active]
154,155d152
< org.eclipse.equinox.launcher (1.6.400.v20210924-0641) "Equinox Launcher" [Resolved]
< org.eclipse.equinox.launcher.cocoa.macosx.x86_64 (1.2.500.v20220509-0833) "Equinox Launcher MacOSX Cocoa Fragment" [Resolved]
230c227
< org.eclipse.ui.console (3.11.200.v20220324-0630) "Console" [Starting]
---
> org.eclipse.ui.console (3.11.200.v20220324-0630) "Console" [Active]
261c258
< org.mozilla.javascript (1.7.10.v20190430-1943) "Mozilla Rhino" [Resolved]
---
> org.mozilla.javascript (1.7.5.v201504281450) "Mozilla Rhino" [Resolved]

The basic code to generate the report is:

String reportfile = Controller.toPluginFilePath("reports/perfReport.rpt");
EngineConfig config = new EngineConfig();
HashMap hm = config.getAppContext();
hm.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, getClass().getClassLoader());
config.setAppContext(hm);
ReportEngine engine = new ReportEngine(config);
Platform.startup(config);
IReportRunnable report = engine.openReportDesign(reportfile);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
Date nameDate = new Date();
if (record.getStartDate() != null) {
    nameDate = record.getStartDate();
} else if (record.getEndDate() != null) {
    nameDate = record.getEndDate();
}
String dtstr = sdf.format(nameDate);
File rptdocument = new File("ptt_report_" + dtstr + ".rptdocument");
IRunTask task = engine.createRunTask(report);
task.run(rptdocument.getAbsolutePath());
task.close();
IReportDocument iReportDocument = engine.openReportDocument(rptdocument.getAbsolutePath());
IRenderTask renderTask = engine.createRenderTask(iReportDocument);
File htmlfile = new File("ptt_report_" + dtstr + ".html");
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName(htmlfile.getAbsolutePath());
options.setOutputFormat("html");
renderTask.setRenderOption(options);
renderTask.render();
renderTask.close();

Any thoughts?

I can’t share the whole app for you to reproduce but I can share snippets or try different debug patches.

Attached are the failing and working inputs and outputs in a zip.

engine_exception.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hvbtupcommented, Jul 5, 2022

Well, at least the exception handling of that code looks really buggy to me.

Most error situations are ignored silently. Lines like System.out.println(...) and e.printStackTrace(); won’t have any effect unless you setup your system to actually show System.out and System.err somehow.

I recommend to rewrite the error and exception handling from scratch. A first step to see what’s going on might involve removing the exception handling complete or to throw a ScriptException with the current exception as cause.

What I mean is: I think that the terrible exception handling hides the actual error, that’s why the stack trace doesn’t contain anything useful.

0reactions
hvbtupcommented, Jul 5, 2022

You could add some additional logging to the Java code to see if your handlers are working as expected (and maybe compare the log output when using the newer javascript plugin to that when using the older plugin.

Anyway, my guess is that root cause of the issue is some unintended behavior change within the Rhino engine.

One question that you didn’t answer yet: Can you reproduce the problem with a JDBC based report (without scripted datasets?).

BTW: Did you already search for known issues in the Rhino project that might be related?

I fear that it will boil down to a diff of the Rhino source code of the two different plugin versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not load the report query error when launch reports ... - IBM
A "Can not load the report query" error occurs when launching reports on a BIRT V3.7 or higher server that is configured for...
Read more >
Issues with creating reports and displaying data source in BIRT
Hi, I have issues currently creating a report using Knime. But also to edit or display a data source in the reports. Maybe...
Read more >
BIRT » Problem when generating dynamic tables - Eclipse
My birt version is 2.6.2. I have an class in java wich i use like an factory to build report itens as php...
Read more >
Birt viewer cannot load the report query - Stack Overflow
Verify that your jdbc driver to the plugins/org.eclipse.birt.report.data.oda.jdbc/driver folder. That's usually what causes this.
Read more >
How to Troubleshoot and Fix Excel Pivot Table Errors
Couldn't Get Data Error ... A simple data change can cause a strange pivot table refresh error, if you added the pivot table...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found