String index out of bound with importpackage [message #1724853] |
Fri, 26 February 2016 14:42 |
osuwariboy Mising name Messages: 24 Registered: December 2010 |
Junior Member |
|
|
Hello everyone,
I have reports deployed on Tomcat 8 using the Webviewer and they all work perfectly. My version of the BIRT runtime is 4.5.0 and the application is deployed in the webapps/birt directory of Tomcat.
The problem is that now, I have a report that has an imbedded script in the beforeFactory that starts with these lines:
importPackage(Packages.org.eclipse.birt.report.item.crosstab.core.de);
importPackage( Packages.org.eclipse.birt.report.model.api );
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core.util);
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core);
importPackage( Packages.org.eclipse.birt.report.model.api.elements);
Now, the script itself works since if I run it through Eclipse, it works without problem. On the other hand, when I put it on the webviewer, I end up with the following error:
birt.core.JavascriptCommonError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "importPackage(Packages.org.eclipse.birt.report.item.crosstab.core.de);
importPackage( Packages.org.eclipse.birt.report.model.api );
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core.util);
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core);
importPackage( Packages.org.eclipse.birt.report.model.api.elements);
var eF = reportContext.getDesignHandle().getElementFactory();
var srt = eF.newSortElement();
if(params["pOrderBy"].value == "SC")
srt.setKey("data[\"Total_GRCertificat/Certificat\"]")
else
srt.setKey("data[\"nbfois_GRCertificat/Age\"]")
srt.setDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
var xtab = reportContext.getDesignHandle().findElement("tab");
var xtabhandle = xtab.getReportItem();
var rws = xtabhandle.getCrosstabView(ICrosstabConstants.ROW_AXIS_TYPE);
var lvh = rws.getDimension("GRCertificat").getLevel(0);
lvh.getModelHandle( ).add( ILevelViewConstants.SORT_PROP, srt );":
String index out of range: 3
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:2039)
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.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)
at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:116)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doPost(BaseReportEngineServlet.java:224)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.birt.core.exception.CoreException: There are errors evaluating script "importPackage(Packages.org.eclipse.birt.report.item.crosstab.core.de);
importPackage( Packages.org.eclipse.birt.report.model.api );
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core.util);
importPackage( Packages.org.eclipse.birt.report.item.crosstab.core);
importPackage( Packages.org.eclipse.birt.report.model.api.elements);
var eF = reportContext.getDesignHandle().getElementFactory();
var srt = eF.newSortElement();
if(params["pOrderBy"].value == "SC")
srt.setKey("data[\"Total_GRCertificat/Certificat\"]")
else
srt.setKey("data[\"nbfois_GRCertificat/Age\"]")
srt.setDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
var xtab = reportContext.getDesignHandle().findElement("tab");
var xtabhandle = xtab.getReportItem();
var rws = xtabhandle.getCrosstabView(ICrosstabConstants.ROW_AXIS_TYPE);
var lvh = rws.getDimension("GRCertificat").getLevel(0);
lvh.getModelHandle( ).add( ILevelViewConstants.SORT_PROP, srt );":
String index out of range: 3
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:295)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:159)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:789)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:718)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScriptInternal(ScriptExecutor.java:118)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScript(ScriptExecutor.java:105)
at org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleBeforeFactory(ReportScriptExecutor.java:114)
... 40 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at java.lang.String.charAt(String.java:658)
at org.apache.catalina.loader.WebappClassLoaderBase.filter(WebappClassLoaderBase.java:2780)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1253)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.birt.report.engine.executor.ApplicationClassLoader.loadClass(ApplicationClassLoader.java:89)
at org.mozilla.javascript.Kit.classOrNull(Kit.java:60)
at org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:127)
at org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:82)
at org.mozilla.javascript.NativeJavaTopPackage.init(NativeJavaTopPackage.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.mozilla.javascript.ScriptableObject.buildClassCtor(ScriptableObject.java:1225)
at org.mozilla.javascript.LazilyLoadedCtor.buildValue0(LazilyLoadedCtor.java:105)
at org.mozilla.javascript.LazilyLoadedCtor.buildValue(LazilyLoadedCtor.java:96)
at org.mozilla.javascript.LazilyLoadedCtor.init(LazilyLoadedCtor.java:66)
at org.mozilla.javascript.ScriptableObject$GetterSlot.getValue(ScriptableObject.java:307)
at org.mozilla.javascript.ScriptableObject$RelinkedSlot.getValue(ScriptableObject.java:347)
at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:456)
at org.mozilla.javascript.IdScriptableObject.get(IdScriptableObject.java:329)
at org.mozilla.javascript.ImporterTopLevel.get(ImporterTopLevel.java:96)
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2184)
at org.mozilla.javascript.ScriptRuntime.topScopeName(ScriptRuntime.java:1824)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1791)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1733)
at org.mozilla.javascript.gen._report_method__name__beforeFactory___222._c_script_0(/report/method[@name="beforeFactory"]:1)
at org.mozilla.javascript.gen._report_method__name__beforeFactory___222.call(/report/method[@name="beforeFactory"])
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.gen._report_method__name__beforeFactory___222.call(/report/method[@name="beforeFactory"])
at org.mozilla.javascript.gen._report_method__name__beforeFactory___222.exec(/report/method[@name="beforeFactory"])
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:290)
... 46 more
I've tested and any of the import statement will generate this error. My best guess is that the webviewer can't load the BIRT packages, but I don't know how to fix this. Anyone has any idea?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04148 seconds