How to register an emitter

ATreus1981
edited February 11, 2022 in Analytics #1
<p>Hi,</p>
<p> </p>
<p>I try to get my own Excel emitter running with the Birt runtime 4.4.2. It is an Eclipse plugin and has everything necessary defined and implemented and is visible in the classpath.</p>
<p> </p>
<p>But when I set the Emitter with EngineConfig.setDefaultEmitter("xlsx", CLASS_NAME) I always get an OutputFormatNotSupprted exception. Looking a bit around in the API has revealed the ExtensionManager class which loads Emitter infromations from schema/emitters.exsd.</p>
<p> </p>
<p>So my question is, have I to build my own Birt distribution to Register my own Emitter or is there a way to use the Birt API for this purpose? Is there a tutorial dealing with the Problem (Google could not help :( )</p>
<p> </p>
<p>Kind Regards</p>
<p>Andreas</p>
<p> </p>
<p> </p>
<p> </p>

Comments

  • <p>Take a look at this article on creating a custom emitter: <a data-ipb='nomediaparse' href='http://www.ibm.com/developerworks/library/ba-birt-emitter/'>http://www.ibm.com/developerworks/library/ba-birt-emitter/</a></p&gt;
    <p> </p>
    <p>It should help in walking you through the process.</p>
    Warning No formatter is installed for the format ipb
  • <p>Hi,</p>
    <p> </p>
    <p>that's what I have done. But creating an IRenderTask and running it leads to the exception described above.</p>
    <p> </p>
    <p>The method setupRenderOption() in class EngineTask does not recognise my emitter. Its line 2156 (extManager.getSupportedFormat()) if the format is set or line 2133 (extManager.isValidEmitterId()) if the emitterID is set....</p>
    <p> </p>
    <p>Regards,</p>
    <p>Andreas</p>
  • <p>Can you attach the emitter so I can test it out in my environment?</p>
    Warning No formatter is installed for the format ipb
  • <p>Find attached the emitter project. Thank you for the support...</p>
    <p> </p>
    <p>Regards,</p>
    <p>Andreas</p>
  • <p>On initial inspection, it looks to me like this may have to do with a conflict in the format name you have specified. When launching an eclipse instance from your project, the emitters you have defined do not show up in the list of available emitters. Which I believe is due to specifying the formats as "xls" and "xlsx" which are already in use by the out of the box emitters.</p>
    <p> </p>
    <p>As a quick test I renamed the format on these to "cust_xls" and "cust_xlsx" and then launched a new eclipse instance from the project. With this change in place, the two emitters now show up as available export formats named "cust_xls" and "cust_xlsx" as I have named them.</p>
    <p> </p>
    <p>I would start by renaming the format of the emitters.</p>
    Warning No formatter is installed for the format ipb
  • <p> Unfortunately the Problem is not resolved: After executing the line:</p>
    <pre class="_prettyXprint">
    config.setDefaultEmitter("xlsx_gnwi", "de.gnwi.birt.emitters.excel.XlsxEmitter");
    </pre>
    <p>And Setting the output format following exception is thrown:</p>
    <pre class="_prettyXprint _lang-xml">
    org.eclipse.birt.report.engine.api.UnsupportedFormatException: The output format xlsx_gnwi is not supported.
    at org.eclipse.birt.report.engine.api.impl.EngineTask.setupRenderOption(EngineTask.java:2162)
    at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:570)
    at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:321)
    at de.gnwi.birt.engine.BirtReportEngine.generateReport(BirtReportEngine.java:99)
    at de.gnwi.birt.engine.AbstractReportServiceImpl$1.call(AbstractReportServiceImpl.java:35)
    at de.gnwi.birt.engine.AbstractReportServiceImpl$1.call(AbstractReportServiceImpl.java:1)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    </pre>
    <p>Regards,</p>
    <p>Andreas</p>
  • <p>That particular error could have quiet a few causes but it typically is going to indicate that the report engine cannot access the emitter.</p>
    <p> </p>
    <p>Can you attach the full code you are using when you get the error?</p>
    <p> </p>
    <p>Have you built your JAR and deployed it to the designers plugins directory?</p>
    <p>Or are launching a new version of eclipse from within the emitter project and coding there?</p>
    Warning No formatter is installed for the format ipb
  • <p>The Birt engine and the emitter are two independend projects. The engine project references the emitter project.<br><br>
    I have attached the two eclipse projects as a minimal working example.<br><br>
    Regards,<br>
    Andreas</p>
  • <p>Hi,</p>
    <p> </p>
    <p> </p>
    <p>I kinda have similar issue.</p>
    <p>I can't use my home mad plugin.</p>
    <p> </p>
    <p>While using it in my project by definig the emitterId :</p>
    <p>final IRenderOption xmlOptions = new RenderOption(options);<br>
        xmlOptions.setOutputFormat("xml");<br>
        xmlOptions.setOutputStream(response);<br>
        runAndRenderTask.setRenderOption(xmlOptions);<br>
        runAndRenderTask.setEmitterID("org.eclipse.birt.report.engine.emitter.xml.XMLReportEmitter");</p>
    <p> </p>
    <p>I got this error :</p>
    <p>juil. 06, 2015 1:39:47 PM org.eclipse.birt.report.engine.api.impl.EngineTask createContentEmitter<br>
    GRAVE: Report engine can not create emitter org.eclipse.birt.report.engine.emitter.xml.XMLReportEmitter.<br>
    juil. 06, 2015 1:39:47 PM org.eclipse.birt.report.engine.api.impl.EngineTask handleFatalExceptions<br>
    GRAVE: An error happened while running the report. Cause:<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:232)<br>
        at fr.inra.means.birt.report.BirtView.renderMergedOutputModel(BirtView.java:123)<br>
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)<br>
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)<br>
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)<br>
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)<br>
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)<br>
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)<br>
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)<br>
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)<br>
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)<br>
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)<br>
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)<br>
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)<br>
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)<br>
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)<br>
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)<br>
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)<br>
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)<br>
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)<br>
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)<br>
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)<br>
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)<br>
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)<br>
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)<br>
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)<br>
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)<br>
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)<br>
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)<br>
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)<br>
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)<br>
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)<br>
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)<br>
        at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)<br>
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)<br>
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)<br>
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)<br>
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)<br>
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)<br>
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)<br>
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)<br>
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)<br>
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)<br>
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)<br>
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)<br>
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)<br>
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)<br>
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)<br>
        at java.lang.Thread.run(Thread.java:745)<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)<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:358)</p>
    <p> </p>
    <p>It seems that the emitter can't be initialized.</p>
    <p> </p>
    <p>I'm using <groupId>org.eclipse.birt.runtime</groupId><br>
                <artifactId>org.eclipse.birt.runtime</artifactId><br>
                <version>4.3.1</version></p>
    <p> </p>
    <p>Any ideas?</p>
    <p> </p>
    <p>Thanks</p>
    <p> </p>
    <p>Caroline</p>
  • <div>Hi I am facing same kind of issue.</div>
    <div> </div>
    <div>Current Scenario:</div>
    <div>In my project we are creating reports using BIRT reporting tool using its 4.5 versioned jar.HTMLReportEmiiter is the main class which generates the html code, which is rendered on browser finally.</div>
    <div>Now it is a requirement for our software to meet 508 Accessibility Compliance. </div>
    <div> </div>
    <div>Requirement:</div>
    <div>As a part of this change,we need to append "lang = 'en' " attribute to html tag like below:</div>
    <div><html lang="en"> to existing generating html source code.</div>
    <div> </div>
    <div>What I tried:</div>
    <div>I created my custom class which extends HTMLReportEmitter class and I override the method "openRootTag" where I can add this "lang" attribute while create html start tag.</div>
    <div> </div>
    <div>Issue I am facing:</div>
    <div>Now issue is how can I register my custom emitter class, so that in actual existing code flow, instead of actual HTMLReportEmitter class object, my custom emitter class object can be in flow and it calls existing code methods and its own single overridden method.</div>
    <div>I saw in BIRT jar,there is plugin.xml file in which this emitter registeration code is given,now how can I achieve the same thing in my existing project.</div>
    <div>Please give some pointers..</div>
  • Clement Wong
    Clement Wong E mod
    edited February 16, 2017 #12
    <p>For your 508 compliance, is the appending of LANG='en' to the <HTML> tag the only change?</p>
    <p> </p>
    <p>If yes, then why not just change the value of TAG_HTML in HTMLTags?</p>
    <p> </p>
    <p>The method openRootTag() contains the line:</p>
    <p style="margin-left:40px;"><span style="font-family:'courier new', courier, monospace;">...</span></p>
    <p style="margin-left:40px;"><span style="font-family:'courier new', courier, monospace;">writer.openTag( HTMLTags.TAG_HTML );</span></p>
    <p style="margin-left:40px;"><span style="font-family:'courier new', courier, monospace;">...</span></p>
    <p> </p>
    <p>Here is the source on GitHub:</p>
    <p><a data-ipb='nomediaparse' href='https://github.com/eclipse/birt/blob/master/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/HTMLTags.java'>https://github.com/eclipse/birt/blob/master/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/HTMLTags.java</a></p&gt;
    <p> </p>
    <p> </p>
    <p>After making the change, compile it so that you can replace the existing HTMLTags in org.eclipse.birt.report.engine_x.y.z.vYYYYMMDDhhmm.jar</p>
    Warning No formatter is installed for the format ipb