Hi,<br />
<br />
I have BIRT (2.5.2) deployed in our Eclipse RCP application (based on Eclipse 3.5). I am using a scripted data source. When I now try to access Enums which are located in one of the plugins of my RCP app, I get errors.<br />
<br />
This is what I do in a script part:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.de.micronova.exam.report.enumeration);
if (x.equals(ValuationEnum.FAIL)) {
...
}
</pre>
<br />
and I get this error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
WARNUNG: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
Script source: , line: 0, text:
__bm_OPEN(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
Script source: , line: 0, text:
__bm_OPEN()
org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
Script source: , line: 0, text:
__bm_OPEN(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
Script source: , line: 0, text:
__bm_OPEN()
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:118)
at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:773)
at org.eclipse.birt.data.engine.script.JSMethodRunner.runScript(JSMethodRunner.java:76)
at org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:90)
at org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.handleJS(DataSetScriptExecutor.java:219)
at org.eclipse.birt.report.engine.script.internal.ScriptDataSetScriptExecutor.handleOpen(ScriptDataSetScriptExecutor.java:88)
at org.eclipse.birt.data.engine.impl.ScriptDataSetRuntime.open(ScriptDataSetRuntime.java:80)
at org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$ScriptDSQueryExecutor$CustomDataSet.open(PreparedScriptDSQuery.java:244)
at org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$ScriptDSQueryExecutor.executeOdiQuery(PreparedScriptDSQuery.java:220)
at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1045)
at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:232)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:158)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:98)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1875)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:75)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
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.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:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
at de.micronova.exam.reporting.job.ReportingJob.run(ReportingJob.java:197)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
Script source: , line: 0, text:
__bm_OPEN()
at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:299)
at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:102)
at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateScript(JavascriptEvalUtil.java:134)
at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evaluateJSAsExpr(ScriptEvalUtil.java:769)
... 37 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "ValuationEnum" is not defined. (/report/method[
@name="initialize"]#65)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3620)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1718)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1657)
at org.mozilla.javascript.gen.c46._c1(/report/method[
@name="initialize"]:65)
at org.mozilla.javascript.gen.c46.call(/report/method[
@name="initialize"])
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c13._c1(:2)
at org.mozilla.javascript.gen.c13.call()
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c8._c0(:0)
at org.mozilla.javascript.gen.c8.call()
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.mozilla.javascript.gen.c8.call()
at org.mozilla.javascript.gen.c8.exec()
at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:95)
... 39 more
</pre>
<br />
<br />
Importing the enum with inportClass does not work as well:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importClass(Packages.de.micronova.exam.report.enumeration.ValuationEnum);
if (x.equals(ValuationEnum.FAIL)) {
...
}
</pre>
<br />
gets me this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Function importClass must be called with a class; had "[JavaPackage de.micronova.exam.report.enumeration.ValuationEnum]" instead. (/report/method[
@name="initialize"]#2)
</pre>
<br />
Note, that at least the first variant worked just fine with Eclipse 3.3 and BIRT 2.2.2.<br />
Now, with Eclipse 3.5 and BIRT 2.5.2 I cannot use my Enums anymore.<br />
Do I miss something there or has something changed here? <br />
Any idea what can be done?<br />
<br />
Cheers,<br />
Tim<br />
<br />
EDIT:<br />
I just noticed that it does not work to access static functions in a static way as well:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.de.micronova.exam.report);
var x = ProjectHome.getRootProject(session);
</pre>
gives the same error as above.<br />
The only workaround I have found is this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage( Packages.org.eclipse.core.runtime );
var reportdatamodel = Platform.getBundle("de.exam.reportdatamodel");
var projectHome = reportdatamodel.loadClass("de.micronova.exam.report.ProjectHome");
var inst = projectHome.newInstance();
var x = inst.getRootProject(session);
</pre>
<br />
This is a hack and does not work for enums - any suggestions?