Home
Analytics
Eclipse Platform not started
lexthang
I'm trying to create a BIRT report engine, as follows (this code is pretty standard I think):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>//Configure the Engine and start the Platform
config = new EngineConfig( );
config.setEngineHome("C:\\work\\birt-runtime-2_5_2\\ReportEngine");
config.setLogConfig(null, java.util.logging.Level.FINE);
Platform.startup( config );
//System.out.println("Core platform running?:" + org.eclipse.core.runtime.Platform.isRunning());
//System.out.println("Eclipse extension reg:" + org.eclipse.core.runtime.Platform.getExtensionRegistry());
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
</pre>
<br />
This will throws a NPE at the last line. Upon inspection, it looks like that line is calling this (inside ReportEngine.java):<br />
IExtensionRegistry registry = Platform.getExtensionRegistry( );<br />
IExtensionPoint extensionPoint = registry.getExtensionPoint( "org.eclipse.birt.core.FactoryService" );<br />
<br />
and the registry is null. It looks like the Platform inside ReportEngine is not yet initialized. (The class is org.eclipse.birt.engine.api.impl.ReportEngine)<br />
<br />
What is puzzling to me is that inside ReportEngine, the Platform is of type org.eclipse.core.runtime.Platform. While the Platform that I start up (with the standard code above) is of type org.eclipse.birt.core.framework.Platform. The BIRT platform is started up just fine, and I did verify that the registry obtained from it is non-null. But the Eclipse platform has never been initialized, and so any call to it fails.<br />
<br />
It looks to me that there is an error inside ReportEngine.java, where references are made to the core Platform while they should have been made to the BIRT Platform instead. But I cannot believe there can be such a glaring and arguably pretty basic error. So the question is, what did I miss? How can I make sure the core eclipse Platform is started? Or if not, how can I substitute the BIRT platform to be used in place of the core eclipse Platform?
Find more posts tagged with
Comments
johnw
That is correct. The org.eclipse.birt.core.framework.Platform is an extension of the Eclipse core framework that takes care of some behind the scene stuff in the OSGi framework. I can't remember the specifics, I looked into what exactly was different a few years ago out of curiosity, but needless to say, makes it easier for the developer to embed into an application and that is the correct Platform for embedding BIRT.
What version of the BIRT runtime are you using?
lexthang
The runtime version is 2.5.2
I got past the problem by the way. In order to compile/execute my above code, my JRE classpath used to have references to some birt-specific jars located under the /plugins directory (birt model, birt core, eclipse core runtime, etc). I was adding jars to the classpath in a selective basis (i.e. whenever there's a ClassNotFoundException) because there are just too many under /plugins. But I got a pointer somewhere that I should point to what's under /lib instead. So I ditched all the jars under /plugins, add all the jars under /lib, after that the problem is gone.
I'm still not sure why it works. Maybe the jars under /plugins are slightly different from those under /lib, or maybe there are some other jars that are needed to in classpath (but which don't throw ClassNotFound). The first reason is probably more plausible.