Home
Analytics
BIRT Scripted Datasource not working
logosm
Hi All,
Problem: BIRT Runtime not picking up my scripted datasource.
BIRT Runtime Version: birt-runtime-2_3_1
I developed a scripted data source in Eclipse and linked this to the report, also designed in Eclipse Report Designer. It works 100% with eclipse preview.
As soon as I copy this to my Java Application running on Linux I get an empty report, with no errors. All other reports work which connects directly to the database.
Linux path of runtime: /birt-runtime-2_3_1/
about_files
about.html
birt.war
epl-v10.html
notice.html
readme.txt
ReportEngine
WebViewerExample
I assume that the location of my java classfile is wrong, not sure where to place it. My java class (Scripted datasource reference) utilizes mysql library which I placed in the lib directory of the birt runtime.
If anyone has any idea how I can solve this issue, it would be greatly appreciated.
Thanks in advance.
LM
Find more posts tagged with
Comments
JasonW
Are you using the API or the WebViewer?
If you are using the api set the parent classloader and then add the jar containing your scripted ds to the classpath as follows:
config.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, YourClass.class.getClassLoader());
//Add to classpath
config.getAppContext().put(EngineConstants.WEBAPP_CLASSPATH_KEY, "c:/jars/myscriptedds.jar");
Jason
logosm
Hi Jason,
Thank you for the reply.
I have done what you suggested, and implemented it as follows:
config = new EngineConfig( );
HashMap hm = config.getAppContext();
hm.put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
MyClass.class.getClassLoader( ) );
config.setAppContext(hm);
I now get the following error:
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.3.0.v20080606
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: [JavaPackage MyClass] is not a function, it is org.mozilla.javascript.NativeJavaPackage. (<inline>#2)
Script source: <inline>, line: 1, text:
__bm_open(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: [JavaPackage MyClass] is not a function, it is org.mozilla.javascript.NativeJavaPackage. (<inline>#2)
Script source: <inline>, line: 1, text:
__bm_open()
What is stange is in eclipse ide designer the data populates perfectly into a PDF, DOC etc. with now errors.
Error pops up in the BIRT Reporting Engine and when I try to preview the data by double clicking on a Chart for example which uses the scriped dataset.
I'm out of ideas at the moment, and not sure where to start troubleshooting.
Any assistance regarding this matter would be greatly appreceated.
Thanks in advance,
Logos
JasonW
Logos,
I did not see in your code:
config.getAppContext().put(EngineConstants.WEBAPP_CLASSPATH_KEY, "c:/jars/myscriptedds.jar");
If your workspace contains a birt report project and a java project the designer should be able to get access to the java projects.
Jason