Home
Analytics
How to integrate new emitter during runtime?
griniland
<p>I wrote my emitter ("MyEmitter") for Birt. No problems with launching it as Elcipse Application (plugin project) - I have new report viewing option, it starts and acts fine. </p><p>But, when I try to use it in my code - Birt Runtime has no ideas about my extension:</p><pre class="_prettyXprint _lang-"> EngineConfig config = new EngineConfig(); config.setLogConfig("c:/temp/birt.log", Level.FINE); Platform.startup(config); IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); IReportEngine engine = factory.createReportEngine(config); engine.changeLogLevel(Level.WARNING); IReportRunnable design = engine.openReportDesign("test.rptdesign"); IRunAndRenderTask task = engine.createRunAndRenderTask(design); IRenderOption options = new RenderOption(); options.setOutputFormat("MyFormat"); options.setOutputFileName("c:/temp/result.MyFormat"); options.setEmitterID("MyEmitter"); task.setRenderOption(options); task.setEmitterID("MyEmitter"); task.run(); task.close(); engine.destroy(); Platform.shutdown();</pre><p>This fails with "unknown emitterID exception". How should I register my emitter during runtime ? </p><p> </p><p>Offline it's "easy": I go to org.eclipse.birt.runtime.4.3.1.jar in my local repository, unzip it, modify plugin.xml (add MyEmitter extension to org.eclipse.birt.emitters point). Then clear signatures in META-INF/MANIFEST.MF for plugin.xml, delete few files with signatures. Repack back to jar. That's it, now my code (see above) finally works.</p><p>Little bit tricky and perverted, is it any convenient way to cope with my task? </p><p>May be - some EngineConfig options? </p><p>Any help will be appreciated. </p><p> </p><p> </p><p> </p>
Find more posts tagged with
Comments
johnw
<p>You only need to export it as a JAR through the Plugin Manifest dialog, then copy the JAR into the BIRT Runtimes "plugins" folder. If you rae running the Java runtime instead of the OSGi runtime, you should just need to copy it to the "lib" folder.</p>
cmalnoe
<p>Hi,<br>
<br>
Despite this responsa was made on 2014.<br>
<br>
I 've kinda same issu (i guess), but i don't get where to copy this jar? (where is the plugins folder? in the webserver?)<br>
<br>
We are using a homemade plugin, and use it in our war.<br>
We build the plugin into a jar (using tycho) and, in the war we had a depency to this jar (plugin) and birt runtime 4.3.1.<br>
<br>
We use this pluging throgought this config:</p>
<p>final IRenderOption xmlOptions = new RenderOption(options);<br>
xmlOptions.setOutputFormat("xml");<br>
xmlOptions.setOutputStream(response);<br>
runAndRenderTask.setRenderOption(xmlOptions);<br>
<span style="color:#ff0000;"> runAndRenderTask.setEmitterID("org.eclipse.birt.report.engine.emitter.xml");</span><br>
log.debug("BirtView makeXml end");<br>
<br>
While running the application, i got a <strong>java.lang.ClassNotFoundException</strong>: org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter<br>
<br>
org.eclipse.birt.report.engine.api.EngineException: Report engine fails to initialize org.eclipse.birt.report.engine.emitter.xml.XMLReportEmitter emitter, please make sure required libraries for this emitter are installed.<br>
at org.eclipse.birt.report.engine.api.impl.EngineTask.createContentEmitter(EngineTask.java:1763)<br>
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:106)<br>
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)<br>
at fr.inra.means.birt.report.BirtView.runReportEngine(BirtView.java:224)<br>
at fr.inra.means.birt.report.BirtView.renderMergedOutputModel(BirtView.java:120)<br>
[..]<br>
Caused by: java.lang.NoClassDefFoundError: org/eclipse/birt/report/engine/emitter/ContentEmitterAdapter<br>
at java.lang.ClassLoader.defineClass1(Native Method)<br>
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)<br>
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)<br>
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)<br>
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)<br>
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)<br>
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)<br>
at java.security.AccessController.doPrivileged(Native Method)<br>
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)<br>
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)<br>
at java.lang.ClassLoader.loadClass(ClassLoader.java:412)<br>
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)<br>
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1456)<br>
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)<br>
at java.lang.Class.forName0(Native Method)<br>
at java.lang.Class.forName(Class.java:191)<br>
at org.eclipse.birt.core.framework.jar.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:46)<br>
at org.eclipse.birt.core.framework.eclipse.EclipseConfigurationElement.createExecutableExtension(EclipseConfigurationElement.java:35)<br>
at org.eclipse.birt.report.engine.extension.internal.ExtensionManager.createObject(ExtensionManager.java:482)<br>
at org.eclipse.birt.report.engine.extension.internal.ExtensionManager.createEmitter(ExtensionManager.java:312)<br>
at org.eclipse.birt.report.engine.api.impl.EngineTask.createContentEmitter(EngineTask.java:1757)<br>
... 68 more<br>
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter<br>
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)<br>
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)<br>
at java.security.AccessController.doPrivileged(Native Method)</p>
<p> </p>
<p>We are using <span><b>Oracle GlassFish Server 3.1.2.2 (build 5). and set AS_JAVA=C:\Program Files\Java\jdk1.7.0_71 </b></span>On the test server it works fine, it's only on the production server, i'm gusseing we are missing something, in the configuration of glassfish?</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>Caroline</p>