Wednesday, February 14, 2007

Emitter Extension Enhancement - BIRT 2.2

I have been working with the new M5 release of BIRT 2.2 for a presentation on extensions at EclipseCon next month. One of the extension points that I will be featuring is the Emitter extension. The M5 release of BIRT has made a significant enhancement to the emitter extension that I wanted to cover in brief today.

In the past emitters were relatively straight-forward: you create a class that extends that either a) implements IContentEmitter or b) extends ContentEmitterAdapter. Within that class you place code to write to an output (stream, file, etc.) and then you visit the various ReportItem components writing the value of the component and any additional information required by your emitter (HTML, PDF, RTF...) It is not an easy task, but it is relatively straight-forward.

The problem would come up when it came time to use your new emitter. It turns out that the ReportEngine code that created and invoked the emitter needed to be modified/patched to add your emitter. This required changing the base Eclipse code and the addition of some new classes. Then this code needed to be re-distributed to the appropriate locations. Not difficult stuff, but not particularly clean. It just made it more difficult for people to use your emitter. So rather than focusing on your emitter code, you had to worry about writing HOW TO IMPLEMENT documentation. Ewwww documentation....

In BIRT 2.2, starting with the M5 build, new emitter plugin extension gets picked up and used automatically. All you have to do is make sure your jar file is in the plugins directory of either the WebViewer (WEB-INF/platform/plugins) or the ReportEngine (/plugins).

I hope to have a demo of this functionality up on either this site or the BIRT Eclipse site some time after the conference.

Scott

26 comments:

  1. Anonymous12:50 AM

    to ease development and integration of custom emitters would be great - is the new feature/procedure documented somewhere??
    thanks for the info
    achim

    ReplyDelete
  2. Anonymous3:03 AM

    hallo,

    i have a problem getting the Report Designer to output to pdf. i have the Birt 2.1.2 All-in-One installed. When i click on the "View Report as PDF" button inside Eclipse, I always get
    org.eclipse.birt.report.service.api.ReportServiceException: Report engine fails to create extension to handle this request.

    i have also searched in web in order to get the answer.

    i have copied iText1.3 jar in plugins/com.lowagie.itext_*/lib directory, also it was installed in
    ReportEngine\plugin\com.lowagie.itext\lib and WebViewerExample\WEB-INF\platform\plugins\com.lowagie.itext\lib

    but still i get the same problem.

    Can anybody please help me

    thanks for help

    ReplyDelete
  3. What is the filesize of the iText jar you have in the lib directory?

    ReplyDelete
  4. Anonymous12:09 PM

    the itext-1.3.3.jar has 1.172KB.

    ReplyDelete
  5. You need iText1.3 not 1.3.3.

    Jason

    ReplyDelete
  6. Anonymous2:38 AM

    Hi Jason,

    it works with iText-1.3 :-), it seems that birt2.1.2 does not like iText-1.3.3.

    many thanks for your help

    ReplyDelete
  7. Anonymous8:03 AM

    I'm having trouble with the new Birt 2.2 emitter feature. Just trying the most basic example, I use the genReport batch file in the ReportEngine directory and provide samples\hello_world.rptdesign as the input. If I use -f html everything is fine. If I use -f pdf (or anything else) it complains about unsupported format. But it works fine in 2.1.2.

    It doesn't seem to be auto-finding the emitter plugins in the plugins directory. Am I missing something?

    Thank you

    ReplyDelete
  8. What java version are you using?
    I just tried with 1.5 and everything worked.
    Have you modified the ReportEngine directory at all?

    Jason

    ReplyDelete
  9. Anonymous12:49 AM

    Indeed. Turns out a colleague had removed some db files b/c that's what some other website said to do to stop a warning message about sampdb. Fresh install worked fine. Merci.

    ReplyDelete
  10. Anonymous3:01 PM

    I have a problem with PDF report on IE where as it works on FF.

    Below is the URL to generate PDF through a BIRT API Deployed on Tomcat server.

    https://10.0.2.71/reports/frameset?__format=pdf&__report=UserActivity/ActivityReportForUsers.rptdesign&RP_st=06/11/2008 01:40:12 PM&RP_et=06/11/2008 02:40:12 PM&RP_sid=f5efbf35fd301947_6205ef3_11a7915ef72_-7323&RP_tz=GMT-07%3A00&RP_userGroup=1&RP_unknown=false&RP_primarySortField=lusr&RP_primarySortOrder=asc&RP_st1=01/01/1970 00:00:00 AM&RP_numrows=10000&__id=40140924

    On IE 7 it gives blank window and no PDF comes up. When sniffed the response through HTTP debugger, PDf response is coming from server but it is corrupted(Not opening up through Acrobat reader 8.1.2).

    Where as same URL works fine with firefox 2.0.0 giving proper PDF report.

    Environment
    Birt Runtime: 2.2.1
    PDF jars: itext-1.5.2.jar, itextasian-1.5.2.jar
    PDF Emitter: org.eclipse.birt.report.engine.emitter.pdf_2.2.1.r22x_v20070921.jar

    It will be great if any one can point out where thing can go wrong.

    Thanks for your time.

    ReplyDelete
  11. Anonymous3:21 AM

    hi frnds
    i m not able to gel csv format in tomcat
    its giving error for ReportServiceException:
    for which no help is there
    so plz help me out if anybody knows abt how to use csv emitter in tomcat
    thx.

    ReplyDelete
  12. HI..
    I am vineet and new to blogger.com
    and I have got stuck on BIRT while running the a .rptdesign file..

    I deployed and did all required stuff and on local server , it is working fine .
    but the momenet I Transfer it on Dev server ..
    it shows the following error
    null; nested exception is:
    org.eclipse.birt.report.service.api.ReportServiceException: The output format html is not supported.
    Please help on this ...
    I am using BIRT2.3


    at the same time there is one confusion in my mind that ..
    my local app sever 5.5.17 and Dev app server is 5.5.20

    This is causing the problem??..
    Please let me know on earliest
    I am deep need of this solution
    Thanks in advance
    vineet

    ReplyDelete
  13. Vineet,

    Sounds like the viewer was not deployed correctly on the Dev machine. Either a permissions problem or an install issue.

    Jason

    ReplyDelete
  14. Hi Jason,
    Thanks for your reply...

    I think you are right.. And I also came to one conclusion is that since I am having all required dependencies in my local machine’s D:\birt-report-designer-all-in-one-2_2_2\eclipse\plugins folder
    And IN my Dev server , I am missing these dependies/plug-ins.

    I guess This may be root of problem...
    And to resolve this issue I may have to map these dependensies in my dev server
    Please give you comment this..
    Thanks in advance

    With Regards
    Vineet

    ReplyDelete
  15. How are you deploying BIRT on the dev machine?

    ReplyDelete
  16. Hi Jason,

    Project that we do have on dev machine is an independent an instance It means it is not deployed into any IDE like eclipse.
    we directly start and stop the server using some shell scrip ..
    But let me tell you one more thing is that. I had combined the web.xml of my project and web.xml of birt-runtime-2_3_2_2 and at the same time I had merged their lib folder too ..
    so now I have made everything in single project on local machine.
    and please see my file structure on local machine
    D:\SmartMonitor1\SmartMonitor3.0\web\birt-viewer\documents

    D:\SmartMonitor1\SmartMonitor3.0\web\birt-viewer\report

    D:\SmartMonitor1\SmartMonitor3.0\web\birt-viewer\webcontent\birt

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\lib

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\platform

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\tlds

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\viewer.properties

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\web.xml

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\weblogic.xml

    D:\SmartMonitor1\SmartMonitor3.0\web\WEB-INF\web-template

    ReplyDelete
  17. HI Jason,,

    one more thing Tomcat version on my local machine is 5.5.17
    and on Dev server it is 5.5.20


    Thanks
    vineet

    ReplyDelete
  18. Hi Jason,

    I was trying to do some R&D fro side sao I found that
    org.eclipse.birt.report.engine.emitter.html_2.3.2.r232_v20090521.jar
    was corrupted in DEv server's plugin folder..

    So finally I got rid of thay annoying error mesage...

    But now there is another error I am getting which is mention below


    Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
    Cannot load JDBC Driver class: oracle.jdbc.driver.OracleDriver.

    Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot load JDBC Driver class: oracle.jdbc.driver.OracleDriver.
    Caused by: org.eclipse.birt.data.engine.core.DataException: Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.Cannot load JDBC Driver class: oracle.jdbc.driver.OracleDriver.

    and here I am givin g the details of some of the jar file whcih are under
    platfoem/plug-ins

    org.eclipse.birt.report.data.oda.xml_2.3.2.r232_v20090211.jar

    org.eclipse.birt.report.data.oda.jdbc.dbprofile_2.3.2.r232_v20090211.jar

    org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb_2.3.2.r232_v20090211.jar

    org.eclipse.birt.report.data.adapter_2.3.2.r232_v20090211.jar


    PLease help on this .. Deadline of my project is approachin...


    Thanks in advance
    vineet

    ReplyDelete
  19. Did you copy the driver jar to the jdbc plugin's drivers directory on the dev machine?

    ReplyDelete
  20. Hi Jason,,

    I did not understand by jdbc plugin's drivers directory on the dev machine

    I am using Oracle 10g
    and I ave coped classes12.jar ,ojdbc14.jat files into platform/plugins directory and WEB-INF directory of dev server

    Thanks Vineet

    ReplyDelete
  21. Look for this plugin in your plugins directory:
    org.eclipse.birt.report.data.oda.jdbc_version
    There is a drivers directory in it. Put it in that folder.

    ReplyDelete
  22. Hi Jason,

    I did that .. and it is working smoothly...
    Thank u very much ..


    With Warm regards
    Vineet

    ReplyDelete
  23. Hi Jason,

    As I was in touch with you for getting my Birt chart smoothly working ...
    But after almost a month ,I have got stuck with a strange problem ..
    Exception I am facing…
    Chart NewChart1:
    - Column binding "1.0*SUM(OFFICE_SPACEUSED)/SUM(OFFICE_ACTIVE_USERS)" has referred to a data set column "1.0*SUM(OFFICE_SPACEUSED)/SUM(OFFICE_ACTIVE_USERS)" which does not exist.
    data.engine.ColumnBindingReferToInexistColumn ( 1 time(s) )
    detail : org.eclipse.birt.report.engine.api.EngineException: Column binding "1.0*SUM(OFFICE_SPACEUSED)/SUM(OFFICE_ACTIVE_USERS)" has referred to a data set column "1.0*SUM(OFFICE_SPACEUSED)/SUM(OFFICE_ACTIVE_USERS)" which does not exist. at org.eclipse.birt.report.engine.executor.ExtendedGenerateExecutor.execute(ExtendedGenerateExecutor.java:70) at org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:61) at

    this is the stackTracke that I Got..

    now situaltion is that .
    my charts are working fine on Dev server and QA server but on production server
    it shows the above mentioned execption But interesting part is that this exception is coming only for 1 chart rest other charts are working fine even in production
    so I thought that probably the problem is there with my query Then I asked DB person to execute the respective query on production DB server which is also working fine ..

    and please find the query also
    select 1.0 * sum(office_spaceused)/sum(office_active_users) , '0-3' from office
    where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=0
    and dateDiff('month',office_createdon,trunc(sysdate)) <3 union all select 1.0 * sum(office_spaceused)/sum(office_active_users) , '3-6' from office
    where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=3 and dateDiff('month',office_createdon,trunc(sysdate)) <6 union all
    select 1.0 * sum(office_spaceused)/sum(office_active_users) , '6-9' from office where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=6 and
    dateDiff('month',office_createdon,trunc(sysdate)) <9 union all select 1.0 * sum(office_spaceused)/sum(office_active_users), '9-12' from office
    where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=9 and dateDiff('month',office_createdon,trunc(sysdate)) <12 union all
    select 1.0 * sum(office_spaceused)/sum(office_active_users) ,'12-15' from office where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=12 and
    dateDiff('month',office_createdon,trunc(sysdate)) <15 union all select 1.0 * sum(office_spaceused)/sum(office_active_users) , '15-18' from office
    where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=15 and dateDiff('month',office_createdon,trunc(sysdate)) <18 union all
    select 1.0 * sum(office_spaceused)/sum(office_active_users) , '18+' from office where env_id IN (3) and dateDiff('month',office_createdon,trunc(sysdate)) >=18 ";


    This query is working fine on all production/dev/QA..

    and DB version on is also same on all prod/dev/QA..
    please help on that Since it is production issue

    ReplyDelete
  24. The chart is complaining that the column binding (see binding tab in properties editor) is complaining that a referenced data set column does not exist. Can you drop a table in front of the chart that is tied to the same dataset and verify it works?

    ReplyDelete
  25. HI,
    Yes Jason I did that and and I get the all records from that particular table along with chart .,

    and one more thing jason . if problem is there with column binding then how is it working on Dev server and QA server??.

    ReplyDelete
  26. Are you saying if you drop the table in front the chart works?
    I am not certain why it works in one environment but not the other.

    ReplyDelete