Friday, August 10, 2012

JBoss BRMS 5.3 - Adding on JasperReports for Reporting

Before we start on the how to section of this article I wanted to welcome a new member of our team. We have an intern working with us in the BRMS team that I would like to introduce, Kumar Bijyendra. What better way to introduce him than to present some of his work, so without further delay, here is the guide to get you started adding on JasperReports for JBoss BRMS 5.3.


Introduction


Jasperreports is a free downloadable library that can be used for generating rich reports for Java EE applications. This guide also provides the steps to generate report templates using Jasper iReport designer.

Software requirements

  • JBoss BRMS 5.3 (from customer portal, http://access.redhat.com
  • JasperReports 4.6.0
  • Jasper iReports
  • Maven (for building report server)
  • Ant (for building JasperReports)

Adding on JasperReports

Just follow these steps to get it up and running.
  1. install JBoss BRMS 5.3 standalone.
  2. create the following directories in in BRMS install
    • $JBOSS_HOME/server/default/data/Jasper
    • $JBOSS_HOME/server/default/data/Jasper/Output 
  3. Download (latest) Jasperreports 4.6.0 from the following location
  4. Extract the contents of the downloaded folder in a local directory.
  5. Goto jasperreports-4.6.0-project\jasperreports-4.6.0 directory where the build.xml file resides and do an ant build. This will create the distribution jars at the following location $path_to_jasper\jasperreports-4.6.0-project\jasperreports-4.6.0\dist
    • Jasperreports-applet-4.6.0
    • Jasperreports 4.6.0.jar
    • Jasperreports-fonts-4.6.0
    • Jasperreports-javaflow-4.6.0
  6. Copy the above jars to the following location
    • $JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\lib
  7. Get report server code from github repository from the following location
  8. Go to the root directory of the downloaded code and do a maven build: mvn clean install. This will generate the distribution jars; reports-core-1.3.0.jar, report-shared-1.3.0.jar 
  9. Copy the two previous jar folders from the dist directory to the $JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\lib 
  10. Delete the existing reports-core-final-1.4.0 and reports-shared-final-1.4.0 in the $JBOSS_HOME\server\default\deploy\gwt-console-server.war\WEB-INF\lib
  11. Download jasper report templates overall_activity.jasper and overall_activity.jrxml from the following link and copy into $JBOSS_HOME/server/default/data/Jasper
  12. Copy the following library jars from $path_to_jasper\jasperreports-4.6.0-project\jasperreports-4.6.0\lib to the following location $JBOSS_HOME\server\default\deploy\gwt-console- server.war\WEB-INF\lib
    • commons-digester-2.1
    • jfreechart-1.0.12
    • jcommon-1.0.15 

Customization and editing .jrxml file

  1. Follow the document JasperReports-Ultimate-Guide-3.0 in docs folder at $path_to_jasper/jasperreports-4.6.0-project\jasperreports-4.6.0\docs
  2. Download and install Jasper iReports designer from the following location
  3. Open the overall_activity.jrxml file in the iReports and edit. Save the .jrxml file and compile by clicking on the preview tab. Copy both the .jrxml (only for future reference) and .jasper file to the $JBOSS_HOME/server/default/data/Jasper 
Enjoy and don't forget to ping Kumar Bijyendra with a big thank you!

Chinese translation available from Christina Lin.