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

Bug 186272

Summary: BIRT doesn't find Java event handlers
Product: z_Archived Reporter: CF <oneskiingfool>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: blocker    
Priority: P3    
Version: 2.2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description CF CLA 2007-05-09 18:57:10 EDT
Ever since 2.2M5, BIRT has been unable to find my Java event handler classes 
at runtime.  I execute my reports from the API and whenever I try to use a 
Java event handler (I use them on datasets), I get the following:

May 9, 2007 2:55:30 PM 
org.eclipse.birt.report.engine.script.internal.ScriptExecutor getInstance
WARNING: org.test.report.BirtHandler
java.lang.ClassNotFoundException: org.test.report.BirtHandler
 at java.lang.ClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:429)
 at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:369)
 at 
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:357)
 at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at 
org.eclipse.birt.report.engine.executor.ExecutionContext$ApplicationClassLoader.loadClass(ExecutionContext.java:1495)
 at 
org.eclipse.birt.report.engine.script.internal.ScriptExecutor.getInstance(ScriptExecutor.java:92)
 at 
org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.initEventHandler(DataSetScriptExecutor.java:49)
 at 
org.eclipse.birt.report.engine.script.internal.ScriptDataSetScriptExecutor.initEventHandler(ScriptDataSetScriptExecutor.java:47)
 at 
org.eclipse.birt.report.engine.script.internal.DataSetScriptExecutor.<init>(DataSetScriptExecutor.java:39)
 at 
org.eclipse.birt.report.engine.script.internal.ScriptDataSetScriptExecutor.<init>(ScriptDataSetScriptExecutor.java:42)
 at 
org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.newScriptDataSet(ModelDteApiAdapter.java:551)
 at 
org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.createDataSetDesign(ModelDteApiAdapter.java:206)
 at 
org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.doDefineDataSet(ModelDteApiAdapter.java:274)
 at 
org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter.defineDataSet(ModelDteApiAdapter.java:233)
 at 
org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.prepare(AbstractDataEngine.java:124)
 at 
org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:104)
 at 
org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportExecutor.execute(LocalizedReportExecutor.java:50)
 at 
org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:76)
 at 
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:205)
 at 
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:125)


Prior to 2.2M5, this has always worked flawlessly. I've put all jar files 
from BirtRuntime/ReportEngine/lib into my web app's lib dir.
I rely heavily on the event handlers, and they're integrated into my app 
rather than a separate jar for scriptlib (I think I saw to do that for when 
using the sample web viewer).







-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ANOTHER NOTE:  When starting up the engine, I now get this message (even 
though I don't want a sample db).

Although I didn't notice it having any effect, it might be related.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

May 9, 2007 2:54:38 PM 
org.eclipse.birt.report.data.oda.sampledb.SampledbPlugin start

INFO: Sampledb plugin starts up. Current startCount=0

May 9, 2007 2:54:38 PM 
org.eclipse.birt.report.data.oda.sampledb.SampledbPlugin init

INFO: Creating Sampledb database at location 
C:\Program Files\Apache\Tomcat\temp/BIRTSampleDB_1178744078729_1f9f538

May 9, 2007 2:54:41 PM 
org.eclipse.birt.report.model.metadata.ExtensionLoader handleError

SEVERE: Message:The element type "org.eclipse.birt.chart.reportitem" is 
invalid. Error code:INVALID_ELEMENT_TYPE

May 9, 2007 2:54:41 PM 
org.eclipse.birt.report.model.metadata.ExtensionLoader handleError

SEVERE: Message:The element type "org.eclipse.birt.report.engine" is 
invalid. Error code:INVALID_ELEMENT_TYPE
Comment 1 Wei Yan CLA 2007-05-09 23:48:44 EDT
do you set the appclassloader of the report engine? it is set in the appContext through EngineConstants.APPCONTEXT_CLASSLOADER_KEY. It should be the web app class loader in your case.
Comment 2 CF CLA 2007-05-10 00:21:15 EDT
No, I hadn't done that, so I tried it and it worked!  Sorry for the false alarm.  It used to work without doing this in previous versions.

engine.getConfig().getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, ReportEngine.class.getClassLoader())

Thanks for the quick response.



(In reply to comment #1)
> do you set the appclassloader of the report engine? it is set in the appContext
> through EngineConstants.APPCONTEXT_CLASSLOADER_KEY. It should be the web app
> class loader in your case.
>