-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BIRT POJO runtime not working #781
Comments
Can you share a simple report and a test class that demonstrates the issue? I don't know how to start the runtime at the moment. I did it a few years back but you would save me a lot of time if you can attach a simple project that demonstrates the issue. |
I didn't really look at the code, but I believe the error is caused by some code change deep inside the Eclipse core, not inside BIRT. Or perhaps it may be related to the newer Java release. |
Thanks, that is very helpful. I will take a look. |
@wimjongman John Ward said on the birt-dev list that he wanted to take a look at it, too. Unfortunately I don't know his GitHub account. I'd be interested if he has made any progress yet. For the PDFPAgeDevice.java error, it is interesting to note that the error happens in static initialization code. AFAIK static variables are considered bad practice with OSGI !? So maybe this can be fixed by somehow avoiding this static initialization. But I think this is not the whole truth, because when I am using the Word emitter in out application, I get a similar error later, when BIRT tries to load the JDBC driver (which is contained in the class-path). I'm not so much a Java insider (the times when I used Java every day were back in the last century), but it seems to me this regression is caused by some changes in the class loading mechanism, either between Java 8 and 11 or between the older and newer Eclipse core framework. By chance, I found a message here https://www.eclipse.org/forums/index.php/t/1104321/ where Sascha Müller said that he had built BIRT and made it work in June 2020 - and someone else replied that it didn't work for him or her - with exactly this ExceptionInInitalizationError in PDFPageDevice.java! Probably Sascha's Eclipse doesn't use the POJO runtime. I forked hvbtup/birt from flugtiger/birt (branch flugtiger_master) before October 2019, then I merged from flugtiger/birt on May 22, 2020. The POJO runtime of my fork is working fine in production use. This make me think that this issue is caused by some changes between flugtiger/birt (flugtiger_master) as of 2020-05-22 and the code Sascha Müller used for https://github.com/SaMuellerDLR/birt (he also forked from flugtiger/birt). |
Henning, I just found some time to look at this. The good news is that I have found the issue, the bad news is that it was all too simple and I'm sorry you had to spend that much time and frustration. Instead of using the birt-runtime, please use the birt-runtime-osgi. [1] [1a][1b]See the artifacts of a recent action run. One of https://github.com/eclipse/birt/actions |
@wimjongman Can you tell me what caused the issue? I can confirm your test, it is working with the osgi-runtime from the lastSuccessfulBuild. What causes me headache is the fact that I built the OSGI runtime 14 days ago and then it didn't work (see my comment in #738) - and I can confirm that result, too. So what has changed in the last 14 days? I'll compare the generated ReportEngine directories of both builds... |
BTW with Java 17 at least the exception (when using the POJO runtime) is clearer: Caused by: java.lang.NullPointerException: Cannot invoke "org.osgi.framework.wiring.FrameworkWiring.findProviders(org.osgi.resource.Requirement)" because "this.fwkWiring" is null My comparison of the builds didn't give me more insight, unfortunately. |
It is worth noting that using the OSGI runtime in production is a bit more complicated than the POJO runtime.
To summarize, replacing the POJO runtime with the OSGI runtime is definitely possible, but not quite straightforward. |
The POJO should run as well. I have to take a look at that NPE. It should not be too difficult. My plan is to see if that class that returns an NPE was changed in eclipse and if it is a regression that stops us. However, I have to find some time. |
+1 for keeping the POJO runtime |
Fixed a faulty access to Platform that did not guard against a possible non-osgi environment.
Fixed all faulty access to Platform that did not guard against a possible non-osgi environment.
Ok, the latest commit fixed the POJO runtime. I have to still polish it but you can take the latest build for a spin. e.g. https://github.com/eclipse/birt/actions/runs/1742145831 |
Didn't yet test your commit, I still try to make our app working with the OSGI runtime. An additional problem might arise if an application uses the BIRT OSGI runtime from several processes (like we do). -DBIRT_HOME=E:\reporting\jlib\birt\v490_osgi_20220123\ReportEngine\platform (I googled for these properties) Before I start the BIRT process, I created the E:\reporting\temp\birt-2 directory and copied the structure from birt-runtime-osgi-4.9.0-20220123.zip\ReportEngine\platform\configuration to E:\reporting\temp\birt-2\configuration. In the process, I use the BIRT_HOME property to call engineConfig.setEngineHome. Despite the osgi.configuration.area setting, BIRT creates .manager directories with *.instance files under E:\reporting\jlib\birt\v490_osgi_20220123\ReportEngine\platform\configuration. This makes me fear issues when several BIRT processes are running simultaneously. |
@wimjongman Now I tested your POJO runtime fix (downloaded from the link you specified). Unfortunately that didn't work - it failed to load the Oracle JDBC driver. org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details: As shown in the stack trace, it seems that your fix does not include the calls to Platform.getBundle from insided the datatools - just a wild guess. |
Yes, that is correct. That is a different project altogether. I try to fix that in platform. |
I have fixed it upstream. https://bugs.eclipse.org/bugs/show_bug.cgi?id=578382 This means we have to wait for 2022/03 to release. Which sounds like a solid target to me. |
Fixed all faulty access to Platform that did not guard against a possible non-osgi environment.
Thanks for your effort, Wim. Meanwhile I tried to find out how to cope with the OSGI runtime. I did not find any way to direct the .manager directories etc to a different location than ReportEngine/platform/configuration. So I'll wait until 2022/03 and hope that the POJO runtime will work then. Will this prevent us from a new BIRT release then? Or should we release nevertheless and only mention that the POJO runtime isn't working at the moment, but will come with the next release then? |
Fixed all faulty access to Platform that did not guard against a possible non-osgi environment.
Thanks! |
@hvbtup said: Meanwhile I tried to find out how to cope with the OSGI runtime. Maybe you can convert that question into a discussion? You have to be careful not to pollute issues with side questions too much. It makes it very hard to keep an overview. Please start with a discussion first so that we can then make separate issues. I think you do not pass the OSGi instance area information correctly but this question has no business in this issue. |
This issue has been partially resolved here. The final fix has been made in the eclipse platform. |
Henning, can you retry? The latest build contains the platform patch. |
@wimjongman You are my hero for today! |
I used the Eclipse setup to download and compile the current "master" today.
This generated the file birt-runtime-4.9.0-20220105.zip (in build\birt-packages\birt-runtime\target).
Unzipped this file and added \Path\to\ReportEngine\lib* to the CLASSPATH environment variable.
Then I tested creating reports from within our application.
This fails with an exception like
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:1826)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:149)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:65)
at com.tp.server.lisa.birt.report.BirtReportGenerator.run(BirtReportGenerator.java:433)
Caused by: java.lang.ExceptionInInitializerError
at org.eclipse.birt.report.engine.emitter.pdf.PDFRender.createPageDevice(PDFRender.java:62)
at org.eclipse.birt.report.engine.layout.emitter.PageDeviceRender.start(PageDeviceRender.java:111)
at org.eclipse.birt.report.engine.layout.emitter.PageEmitter.start(PageEmitter.java:50)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.start(LayoutEngine.java:265)
at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.start(CompositeContentEmitter.java:171)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:140)
... 2 more
Caused by: java.lang.NullPointerException
at org.eclipse.core.internal.runtime.InternalPlatform.getBundles(InternalPlatform.java:232)
at org.eclipse.core.internal.runtime.InternalPlatform.getBundle(InternalPlatform.java:222)
at org.eclipse.core.runtime.Platform.getBundle(Platform.java:1442)
at org.eclipse.birt.report.engine.internal.util.BundleVersionUtil.getBundleVersion(BundleVersionUtil.java:33)
at org.eclipse.birt.report.engine.emitter.pdf.PDFPageDevice.(PDFPageDevice.java:84)
... 8 more
Another report (which uses the DOCX emitter instead of the PDF emitter failed with a similar error in the stacktrace while trying to load the JDBC driver.
Has anybody successfully tested the (non-osgi) runtime?
Note:
Generating reports worked with Java 8 and my fork hvbtup/birt (branch flugtiger-master).
I've performed the process of building BIRT (using Maven) and using the generated birt-runtime-4.*.zip several times and never had any problems until now, thus I am pretty sure that my environment variables etc. are ok.
The number and size of the jar files in reportengine/lib seems to be ok as well.
The difference is that now I am using the eclipse/master trunk (after the "BIRT reboot") and Java 11 instead of Java 8.
In case of PDFPageDevice.java we know exactly what bundle is searched, because the error happens in this line:
As a side note, launching "BIRT all-in-one.launch" and previewing reports from the launched "Report-All-In-One" designer works like a charm.
![grafik](https://user-images.githubusercontent.com/7644776/148256197-7424cb71-8511-47c9-8c0d-b5eb441534b1.png)
The only thing I had to adjust to make it work was to check an entry for OSGI in the .launch file:
Can someone please confirm that the BIRT runtime (generated fresh from master) is working with Java 11 or tell me what's wrong here?
The text was updated successfully, but these errors were encountered: