Home
Analytics
Birt configuration
james681
Hi,
I am a newbie in java and birt so i wanted to integrate Birt in java in order to build a simple report and here is the exception that i got:
org.eclipse.birt.core.exception.BirtException: Cant startup the OSGI framework
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:91)
at test.DeDemo.buildReport(DeDemo.java:75)
at test.DeDemo.main(DeDemo.java:37)
Caused by: org.eclipse.birt.core.exception.CoreException
at org.eclipse.birt.core.framework.osgi.OSGILauncher.startup(OSGILauncher.java:90)
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:79)
... 2 more
Exception in thread "main" java.lang.NullPointerException
at test.DeDemo.buildReport(DeDemo.java:90)
at test.DeDemo.main(DeDemo.java:37)
I have the eclipse IDE for java devlopers and i have installed birt by update manager.
Any help will be appreciated!
thanks
Find more posts tagged with
Comments
Happy
Probably missing classpath entries, or have too many.<br />
<br />
You should only import the contents of the ReportEngine/Lib directory into your classpath (plus whatever non-birt related entries you need). If you import the ReportEngine/Plugins directory, you will get many many errors.<br />
<br />
As an example, here is what I did:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
String BIRT_HOME = "D:Appsbirt-runtime-2_5_0ReportEngine";
EngineConfig ec = new EngineConfig();
ec.setBIRTHome(BIRT_HOME); // Probably do not need this step
ec.setEngineHome(BIRT_HOME);
try {
System.out.println("Starting up Platform");
Platform.startup(ec);
IReportEngineFactory factory = (IReportEngineFactory) Platform.
createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
IReportEngine engine = factory.createReportEngine(ec);
// Do run and render code
engine.destroy();
} catch (BirtException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally
{
Platform.shutdown();
}
</pre>
james681
thanks for you reply,
But how did you define BIRT_HOME, i mean the URL ?
I am unable to fine the birt-runtime-2_5_0 folder!!
thanks
Happy
Set the BIRT_HOME string to the location on the hard drive where you unzipped the BIRT runtime libraries.
If you unzipped them to C:BIRT than the String is likely to be:
"C:BIRTReportEngine";
By the way, the example above was written with BIRT 2.5.0 in mind, I do not know if it is backwards compatible to previous versions.