Friday, March 24, 2006

Java and Session Objects in BIRT

One of the discussion in the BIRT In Depth tutorial was the use of java objects (pojos) and session objects within a BIRT report. To demonstrate these functions, I created two reports. The first is named java_object_integration.rptdesign and it uses the java.lang.System object to get the properties of the system and display them in the report.

The second uses a Java Event Handler to load a hashtable. The hashtable contains additional hashtables (request attributes, request parameters, session attributes, and System properties). These name value pairs are then displayed in the report design.

I have high hopes of writing this up in a more formal manner for display on the BIRT web site, but I am pretty busy right now. I have noticed a number of posts on the newsgroup asking for this information, so I am going to just put the reports are here without explanation. Hopefully someone will find this useful. If anyone is feeling ambitious and wants to write this up, please do and I will publish your contribution to the BIRT web site.

To have a look at the files download the following file:

The first example of using a pojo only is fairly easy, just use the java_object_integration.rptdesign. It should run in your environment and give you a report of the System properties.

The next example is a little more complicated. The logic to build my data stream was easier to do in Java so I wanted to use Java Event Handlers. The java files that are in the zip directory will need to be in the source directory of your project, yes it needs to be java project. If you need some help you might try the documentation on Java Event handlers or you can wait until after the weekend when I update this.

Sorry for not finishing tonight, but I have not seen my family all week and there will be a rebellion if I don't attend to the important things (Sam is 2.5 and Louise is 4).

If you want to see a quick picture here is the report that uses a POJO to get the system properties:

This is a screen capture of the report that gets information from the request and session objects:


Anonymous said...

hi Jason,
i have tried the example given. the first report got executed. where as the second report (application_session_integration.rptdesign) is not executed. it is throwing java.lang.NullPointerException. i compiled the given java files in and placed them in can u provide me the steps to solve this problem.

Jason Weathersby said...

Can you send me an email with the report and version you are using?
jweathersby at


Anonymous said...


The link to the ZIP file is broken - could you post an update to this please ?


Anonymous said...

Sorry, we changed our corporate site. I need to re-build this file. What version of BIRT are you using?


Mariano Molina said...


The link to the ZIP file is broken - could you post an update to this please ?
I am using the BIRT Version 2.5.2

akhilapriya404 said...

Thanks for sharing this blog post,Nice written skill core Java online training Bangalore