Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Help to fix the error in creating BIRTengine
Johndr
Hi all,<br />
<br />
I am getting an exception at statement <strong class='bbc'>factory.createReportEngine(config)</strong> from the code below in Servlet. Could anyone please help me to fix this. <br />
I have copied all 84 jars from birt-runtime-3_7_0\ReportEngine\lib to lib folder in our web application.<br />
<br />
public static synchronized IReportEngine getBirtEngine(ServletContext sc) {<br />
<p class='bbc_indent' style='margin-left: 40px;'>IReportEngine engine = null;<br />
try {<br />
<p class='bbc_indent' style='margin-left: 40px;'>final EngineConfig config = new EngineConfig();<br />
config.setPlatformContext(new PlatformServletContext(sc));<br />
Platform.startup(config);<br />
IReportEngineFactory factory = (IReportEngineFactory) Platform<br />
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);<br />
engine = <span style='color: #FF0000'>factory.createReportEngine(config)</span>;<br /></p>
} catch (Throwable t) {<br />
t.printStackTrace();<br />
}<br />
<br />
return engine;<br /></p>
}<br />
<br />
Exception:<br />
java.lang.NullPointerException<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngine$EngineExtensionManager.<init>(ReportEngine.java:804)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:110)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:18)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:1)<br />
at java.security.AccessController.doPrivileged(AccessController.java:202)<br />
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:14)<br />
<br />
Thanks and Regards,<br />
John
Find more posts tagged with
Comments
Yaytay
Line 804 in ReortEngine.java is:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
802 IExtensionRegistry registry = Platform.getExtensionRegistry( );
803 IExtensionPoint extensionPoint = registry
804 .getExtensionPoint( "org.eclipse.birt.core.FactoryService" );
</pre>
So your Platform is returning null for registry.<br />
<br />
My first guess is that your ServletContext is somehow invalid.<br />
Can you check that it is not null, and can you let us know what app server you are running on?<br />
Thanks.
Johndr
Thanks for your reply.
This error was because I forgot to delete platform folder from WEB-INF.
Now when I deleted the folder it is working fine.
Thanks and Regards,
John