Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331504

Summary: Exception when adding a chart in a webproject using BIRT
Product: z_Archived Reporter: Missing name Mising name <loebe0>
Component: BIRTAssignee: Heng Li <liheeng>
Status: CLOSED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: major    
Priority: P3 CC: bluesoldier, cooll, jouyang, Lionel.wyl, qwe, raghunadh.madamanchi
Version: unspecified   
Target Milestone: 3.7.0 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
screenshot of exception none

Description Missing name Mising name CLA 2010-12-01 02:50:00 EST
Build Identifier: 20100917-0705

Charts works as intended until the runtime jar files are added to the webapps lib directory. After that, editing or adding a chart gives the following exception

org.eclipse.birt.chart.exception.ChartException at:
org.eclipse.birt.chart.reportitem.ui.ReportDataServiceProvider.initialize(ReportDataServiceProvider.java:279)
org.eclipse.birt.chart.ui.swt.wizard.preview.ChartLivePreviewThread.initDataEngine(ChartLivePreviewThread.java:237)
org.eclipse.birt.chart.ui.swt.wizard.preview.ChartLivePreviewThread.run(ChartLivePreviewThread.java:153)

Caused By:Loader can not resolve Rhino classes
org.mozilla.javascript.Context.setApplicationClassLoader(Context.java:2306)
org.eclipse.birt.report.engine.javascript.JavascriptEngine.setApplicationClassLoader(JavascriptEngine.java:325)
org.eclipse.birt.core.script.ScriptContext.createEngine(ScriptContext.java:244)
org.eclipse.birt.core.script.ScriptContext.getScriptEngine(ScriptContext.java:230)
org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.<init>(ModelDteApiAdapter.java:177)
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.<init>(AbstractDataEngine.java:107)
org.eclipse.birt.report.engine.data.dte.DteDataEngine.<init>(DteDataEngine.java:85)
org.eclipse.birt.report.engine.data.DataEngineFactory.createDataEngine(DataEngineFactory.java:100)
org.eclipse.birt.report.engine.executor.ExecutionContext.openDataEngine(ExecutionContext.java:837)
org.eclipse.birt.report.engine.executor.ExecutionContext.getDataEngine(ExecutionContext.java:854)
org.eclipse.birt.report.engine.api.impl.EngineTask.getDataSession(EngineTask.java:525)
org.eclipse.birt.chart.reportitem.ui.ReportDataServiceProvider.initialize(ReportDataServiceProvider.java:257)
org.eclipse.birt.chart.ui.swt.wizard.preview.ChartLivePreviewThread.initDataEngine(ChartLivePreviewThread.java:237)
org.eclipse.birt.chart.ui.swt.wizard.preview.ChartLivePreviewThread.run(ChartLivePreviewThread.java:153)

(sorry for the stack trace. no "Add an Attachment" link found)

for more details see discussion at
http://www.eclipse.org/forums/index.php?t=msg&goto=642273&S=2f214ec83c0928838d855fc49af5ca42#msg_642273
and
http://www.eclipse.org/forums/index.php?t=msg&goto=631351&S=4f88425ff51c8188d2cd02da6d3e98ef

Reproducible: Always

Steps to Reproduce:
1. create a web project
2. add BIRT runtime jar files to the webapps lib directory
3. add a chart to a report
Comment 1 Missing name Mising name CLA 2010-12-01 02:50:46 EST
Created attachment 184225 [details]
screenshot of exception
Comment 2 Jun Ouyang CLA 2010-12-02 02:20:37 EST
The js.jar in lib folder cause class loading conflict, deleting the jar can fix this problem.

Normally there are 2 working mode of BIRT: OSGi in web and web in OSGI. BIRT runtime in web application works as OSGi in web mode. Designer works as web in OSGi mode.

This problem occurs because it tries to work in BOTH mode. The rhino classes loaded from lib folder while BIRT Engine is supposed to depend on rhino plugin because it's in designer.

Deleting js.jar can fix this problem. But there might be some other potential problems. To keep on safe side, user can create another project same as the web project except that no BIRT runtime jars are placed in lib folder, and use this project for report edition only.
Comment 3 Lionel CLA 2010-12-02 08:21:24 EST
Removing js.jar from tomcat/lib is not possible: the report won't run anymore from the web application:
java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable
	at org.eclipse.birt.core.data.DataTypeUtil.convert(DataTypeUtil.java:91)

It was working perfectly with galileo and birt 2.5.2.
Comment 4 Xiaoying Gu CLA 2010-12-03 01:39:17 EST
(In reply to comment #3)
> Removing js.jar from tomcat/lib is not possible: the report won't run anymore
> from the web application:
> java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable
>     at org.eclipse.birt.core.data.DataTypeUtil.convert(DataTypeUtil.java:91)
> It was working perfectly with galileo and birt 2.5.2.

I think the work around is not suggesting removing js.jar from WEB-INF/lib/ in the runtime environment. If you attempt to modify the report design under a WEB project directly, the trick may work. For previewing, the js.jar is absolutly reqruired.
Comment 5 Xiaoying Gu CLA 2011-03-15 22:07:59 EDT
*** Bug 334740 has been marked as a duplicate of this bug. ***
Comment 6 Xiaoying Gu CLA 2011-03-19 01:08:14 EDT
Reopen for more investigation.
Comment 7 Heng Li CLA 2011-04-08 03:26:14 EDT
This regression was caused by inappropriate usage of Engine's APIs, according to Engine's suggestion, chart has fixed this bug by using PROJECT_CLASS_PATH instead of APPCONTEXT_CLASS_PATH to save external class path.
Comment 8 raghunadh.madamanchi CLA 2011-06-21 05:08:02 EDT
(In reply to comment #7)
> This regression was caused by inappropriate usage of Engine's APIs, according
> to Engine's suggestion, chart has fixed this bug by using PROJECT_CLASS_PATH
> instead of APPCONTEXT_CLASS_PATH to save external class path.


Can you please let me know, In which version of BIRT, is this Fixed?
Comment 9 Heng Li CLA 2011-06-21 05:16:02 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > This regression was caused by inappropriate usage of Engine's APIs, according
> > to Engine's suggestion, chart has fixed this bug by using PROJECT_CLASS_PATH
> > instead of APPCONTEXT_CLASS_PATH to save external class path.
> 
> 
> Can you please let me know, In which version of BIRT, is this Fixed?

Please use the latest release version 3.7
Thanks.