Community
Participate
Working Groups
can somebody please give me a hint what I am doing wrong here? When I try to use the embedded POI in BIRT 4.4.2, I get the below exception. Everything works fine with BIRT 4.2.2. I have tried to fix this myself, but with no luck. Perhaps my problem is the same as the one described in Bug 398774 - POI version conflict caused by BIRT Runtime 4.2.0. But I can't figure this out. To reproduce the error simply generate a report from poi.rptdesign contained in poi.zip. It contains mainly this code, which tries to open an excel file // Just load the excel file // and show that org.apache.poi.ss.usermodel.ShapeTypes is well defined var fis = new Packages.java.io.FileInputStream(wd + "poi.xls"); dbg.println("ACTION_BUTTON_DOCUMENT " + typeof Packages.org.apache.poi.ss.usermodel.ShapeTypes.ACTION_BUTTON_DOCUMENT + " " + Packages.org.apache.poi.ss.usermodel.ShapeTypes.ACTION_BUTTON_DOCUMENT); dbg.println("fis " + typeof fis + " " + fis); // The following line works fine with BIRT 4.2.2 but fails with BIRT 4.4.2 var wb = new Packages.org.apache.poi.ss.usermodel.WorkbookFactory.create(fis); Exception details (see also poi.zip/poi.stderr.log) TypeError: [JavaPackage org.apache.poi.ss.usermodel.WorkbookFactory.create] is not a function, it is object. (/report/method[@name="beforeFactory"]#14) at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:249) at org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleBeforeFactory(ReportScriptExecutor.java:122) at org.eclipse.birt.report.engine.api.impl.EngineTask.startFactory(EngineTask.java:2030) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:101) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77) at org.eclipse.birt.report.engine.api.ReportRunner.runAndRenderReport(ReportRunner.java:245) at org.eclipse.birt.report.engine.api.ReportRunner.execute(ReportRunner.java:168) at org.eclipse.birt.report.engine.api.ReportRunner.main(ReportRunner.java:127)
Created attachment 252778 [details] poi.rptdesign reproduces the exception
Eventually I found a work around that works for me: 1. Copy every class from org.apache.poi_3.9.0.v201303080712.jar to org.eclipse.birt.runtime_4.4.2.v20150217-1805.jar 2. Rename org.eclipse.birt.runtime_4.4.2.v20150217-1805.jar into org.eclipse.birt.runtime_4.4.2.v20150217-1805-poi.jar 3. Delete org.apache.poi_3.9.0.v201303080712.jar This is all you need to be able to run a report with genReport.bat. In order to run a report in Eclipse, you have to 4. Add org.eclipse.birt.runtime_4.4.2.v20150217-1805-poi.jar to Eclipse-Project->Properites->Report Design->Classpath->Add External JARs... or as a resource to the report itself Report->Property Editor->Resources->Jar Files->Add File... I know this is very, very ugly.