BIRT report with scripted data set does not show in Preview tab

rakesh4111
edited February 11, 2022 in Analytics #1
Here's my situation:

I am using BIRT 2.1 made available by download in the Rational Software Architect IDE.

I've created a Java project and a class that connects to a DB2 database, retrieves a result set, and stores the results in a vector, very much like the various BIRT tutorials that have to do with Scripted Data Sets. The class was created under a package, and I then exported this package to:
D:Program FilesIBMSDP70Sharedpluginsorg.eclipse.birt.rep ort.viewer_2.1.2.v20070205-1728birtWEB-INFlib

In BIRT, I create a scripted data source and a scripted data set based on that data source. In the 'open' tab of the script I put the following:

asset = Packages.hwOwnedAssets.BlueboxCandidates();
count = 0;
assetVector = asset.assetQuery();
assetVectorSize = assetVector.size();


In the 'fetch' tab:

if (count > assetVectorSize - 1) {
return false;
} else {
currRow = assetVector.get(count);
row["FunctionGroup"] = currRow[5];
row["ITGroupName"] = currRow[6];
row["LocationType"] = currRow[4];
row["Dept"] = currRow[3];
row["HWClass"] = currRow[7];
count++;
return true;
}

The data set has all of the necessary output columns. When I open the data set in the Data Explorer toolbar and go to 'Preview' the data shows up fine. However when I create a table and drag the data set elements into it, upon clicking the 'Preview' tab in the editor pane (where the Layout, MasterPage, Script, and XML Source tabs are found) the report does not appear. Instead I get this error:

Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException : There are errors evaluating script "asset = Packages.hwOwnedAssets.BlueboxCandidates();count = 0;assetVector = asset.assetQuery();assetVectorSize = assetVector.size();". at org.eclipse.birt.report.engine.script.internal.DtE ScriptExecutor.handleJS(Unknown Source) at org.eclipse.birt.report.engine.script.internal.Dat aSetScriptExecutor.handleJS(Unknown Source) at org.eclipse.birt.report.engine.script.internal.Scr iptDataSetScriptExecutor.handleOpen(Unknown Source) at org.eclipse.birt.data.engine.impl.ScriptDataSetRun time.open(Unknown Source) at org.eclipse.birt.data.engine.impl.PreparedScriptDS Query$ScriptDSQueryExecutor$CustomDataSet.open(Unk nown Source) at org.eclipse.birt.data.engine.impl.PreparedScriptDS Query$ScriptDSQueryExecutor.executeOdiQuery(Unknow n Source) at org.eclipse.birt.data.engine.impl.QueryExecutor.ex ecute(Unknown Source) at org.eclipse.birt.data.engine.impl.ServiceForQueryR esults.executeQuery(Unknown Source) at org.eclipse.birt.data.engine.impl.QueryResults.get ResultIterator(Unknown Source) at org.eclipse.birt.report.engine.data.dte.DteResultS et.<init>(Unknown Source) at org.eclipse.birt.report.engine.data.dte.DteDataEng ine.doExecuteQuery(Unknown Source) at org.eclipse.birt.report.engine.data.dte.AbstractDa taEngine.execute(Unknown Source) at org.eclipse.birt.report.engine.executor.ExecutionC ontext.executeQuery(Unknown Source) at org.eclipse.birt.report.engine.executor.QueryItemE xecutor.executeQuery(Unknown Source) at org.eclipse.birt.report.engine.executor.TableItemE xecutor.execute(Unknown Source) at org.eclipse.birt.report.engine.internal.executor.l 18n.LocalizedReportItemExecutor.execute(Unknown Source) at org.eclipse.birt.report.engine.layout.html.HTMLPag eLM.layoutChildren(Unknown Source) at org.eclipse.birt.report.engine.layout.html.HTMLPag eLM.layout(Unknown Source) at org.eclipse.birt.report.engine.layout.html.HTMLRep ortLayoutEngine.layout(Unknown Source) at org.eclipse.birt.report.engine.api.impl.RunAndRend erTask.doRun(Unknown Source) at org.eclipse.birt.report.engine.api.impl.RunAndRend erTask.run(Unknown Source) at org.eclipse.birt.report.service.ReportEngineServic e.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.ReportEngineServic e.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.BirtViewerReportSe rvice.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.actionhandler.Birt RunAndRenderActionHandler.__execute(Unknown Source) at org.eclipse.birt.report.service.actionhandler.Abst ractBaseActionHandler.execute(Unknown Source) at org.eclipse.birt.report.presentation.aggregation.l ayout.EngineFragment.doService(Unknown Source) at org.eclipse.birt.report.presentation.aggregation.A bstractBaseFragment.service(Unknown Source) at org.eclipse.birt.report.servlet.BirtEngineServlet. __doGet(Unknown Source) at org.eclipse.birt.report.servlet.BaseReportEngineSe rvlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(Unknown Source) at org.apache.axis.transport.http.AxisServletBase.ser vice(Unknown Source) at javax.servlet.http.HttpServlet.service(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.do Filter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invo ke(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(U nknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unkn own Source) at org.apache.catalina.core.StandardContextValve.invo ke(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.CertificatesValve.invok e(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(U nknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unkn own Source) at org.apache.catalina.core.StandardContext.invoke(Un known Source) at org.apache.catalina.core.StandardHostValve.invoke( Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.in voke(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.eclipse.tomcat.internal.EclipseErrorReportValv e.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(U nknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unkn own Source) at org.apache.catalina.core.StandardEngineValve.invok e(Unknown Source) at org.apache.catalina.core.StandardPipeline$Standard PipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(U nknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unkn own Source) at org.apache.coyote.tomcat4.CoyoteAdapter.service(Un known Source) at org.apache.coyote.http11.Http11Processor.process(U nknown Source) at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Unknown Source) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(U nknown Source) at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "size" of null Script source: DataSet[Assets].__bm_OPEN, line: 1, text:__bm_OPEN(). See next exception for more information.Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "size" of null Script source: DataSet[Assets].__bm_OPEN, line: 1, text:__bm_OPEN() at org.eclipse.birt.data.engine.core.DataException.wr ap(Unknown Source) at org.eclipse.birt.data.engine.script.ScriptEvalUtil .evaluateJSAsExpr(Unknown Source) at org.eclipse.birt.data.engine.script.JSMethodRunner .runScript(Unknown Source) ... 64 moreCaused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "size" of null Script source: DataSet[Assets].__bm_OPEN, line: 1, text:__bm_OPEN() at org.eclipse.birt.core.script.JavascriptEvalUtil.wr apRhinoException(Unknown Source) at org.eclipse.birt.core.script.JavascriptEvalUtil.ev aluateRawScript(Unknown Source) at org.eclipse.birt.core.script.JavascriptEvalUtil.ev aluateScript(Unknown Source) ... 66 moreCaused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "size" of null at org.mozilla.javascript.ScriptRuntime.constructErro r(Unknown Source) at org.mozilla.javascript.ScriptRuntime.constructErro r(Unknown Source) at org.mozilla.javascript.ScriptRuntime.typeError(Unk nown Source) at org.mozilla.javascript.ScriptRuntime.typeError2(Un known Source) at org.mozilla.javascript.ScriptRuntime.undefCallErro r(Unknown Source) at org.mozilla.javascript.ScriptRuntime.getPropFuncti onAndThis(Unknown Source) at org.mozilla.javascript.optimizer.OptRuntime.callPr op0(Unknown Source) at org.mozilla.javascript.gen.c10._c1(Unknown Source) at org.mozilla.javascript.gen.c10.call(Unknown Source) at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(Unknown Source) at org.mozilla.javascript.gen.c11._c0(Unknown Source) at org.mozilla.javascript.gen.c11.call(Unknown Source) at org.mozilla.javascript.ContextFactory.doTopCall(Un known Source) at org.mozilla.javascript.ScriptRuntime.doTopCall(Unk nown Source) at org.mozilla.javascript.gen.c11.call(Unknown Source) at org.mozilla.javascript.gen.c11.exec(Unknown Source) ... 68 more

What's funny is that this worked just yesterday and then all of a sudden it seems to have stopped working.

Any ideas?

Comments

  • kimbad
    edited December 31, 1969 #2
    I had a similar problem with scripted datasets and eventually raised this bug<br />
    <br />
    <a class='bbc_url' href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=202092'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=202092</a><br />
    <br />
    The issue appears to be that jars in the viewer classpath are not available at design time as the design plugin is using a different classpath.<br />
    <br />
    Kim
  • rakesh4111
    edited December 31, 1969 #3
    Thank you so much for replying Kim. You really shed some light on my issue.

    Currently, I do have the report working in the preview mode from within the data set and from the preview tab for Birt 2.1 running under RSA and BIRT 2.2 running under Eclipse. To get it to work though, there was a lot of trial and error and I have my jars scattered around the place.

    For Birt 2.1 I've put the jar in the following directories:
    D:Program FilesIBMSDP70Sharedpluginsorg.eclipse.birt.report.viewer_2.1.2.v20070205-1728birtWEB-INFlib

    and

    D:Program FilesIBMrationalsdp7.0workspaceBlueboxCandidates_1 (the actual project directory). There was no 'scriptlib' or 'classes' folder available under the Web-INF folder.

    For Birt 2.2 (the one I'm using with Eclipse) I've put the jar file in the following directories:

    D:Program FilesEclipseeclipsepluginsorg.eclipse.birt.report.viewer_2.2.2.r22x_v20071213birtWEB-INFclasses (I had to create the classes directory). I've also extracted the .class file (probably not necessary but I thought why not) and put it in the same directory.

    and

    D:Program FilesEclipseeclipsepluginsorg.eclipse.birt.report.viewer_2.2.2.r22x_v20071213birtscriptlib

    scriptlib direcotory was available under the Eclipse installation as opposed to the RSA installation.

    So I'm going to play around to see if I can determine exactly where the jar file is to be placed but would you be able to tell me under which directory the .jar file should be placed so I can verify my tests? It just seems like all the info out there on the forums say to do the same thing but none of them have worked consistently in both types of preview mode.

    Thank you again Kim.
  • rakesh4111
    edited December 31, 1969 #4
    To follow up, I now have the report working consistently in BIRT 2.1 with the jar in the lib folder and no where else. I haven't experienced as much with BIRT 2.2 but I imagine it should have similar results. I'm still confused as to why I was having so many problems last week though.