terrarum

home rss

Deploying BIRT on Tomcat

08 Mar 2011

Introduction

As an alternative to my article on Deploying BIRT on JBoss, this article will cover BIRT and Tomcat.

Background information on BIRT and the usefulness of hosting BIRT reports on a central server is covered in that prior article.

Tomcat

Installing Tomcat

I'm using a CentOS 5.5 server for this article.

Installation of Tomcat is quite straightforward with yum:

# yum install tomcat5 tomcat5-admin-webapps xml-commons-apis

Configuring Tomcat

Configuring Tomcat is just as simple as its installation. The only item I had to complete was to add an admin user. I did this by editing the file /etc/tomcat5/tomcat-users.xml file and adding the following line:

<user username="admin" password="admin" roles="admin,manager"/>

Note, please pick a better password.

The admin panel of Tomcat can now be accessed via http://192.168.255.2:8080/admin or whatever your server's IP address or hostname is.

BIRT

Installing Java

I found that the latest version of BIRT would not run without Java 1.6 installed.

I downloaded the Java 1.6 JDK from its homepage. The exact file name was jdk-6u24-linux-i586-rpm.bin.

When the download finishes, run the file as a shell script:

# sh jdk-6u24-linux-i586-rpm.bin

This installs the various Java components as RPM packages.

Next, edit /etc/sysconfig/tomcat5 and change the JAVA_HOME environment variable to /usr/java/jdk1.6.0_24/

Installing the BIRT Viewer

The BIRT Viewer can be downloaded from here as the Runtime package. Once it has downloaded, unzip the package and then copy the WebViewerExample directory to /var/lib/tomcat5/webapps as birt:

# unzip birt-runtime-2_6_2.zip
# cd birt-runtime-2_6_2.zip
# cp -a WebViewerExample /var/lib/tomcat5/webapps/birt

Also make sure that the birt directory has the correct permissions for the user running the Tomcat server – in this case, tomcat:

# chown -R tomcat /var/lib/tomcat5/webapps/birt

Next, restart Tomcat

# /etc/init.d/tomcat5 restart

Finally, make sure BIRT is running by accessing the Tomcat Manager page at http://192.168.255.2:8080/manager/html. If it is, you can access the BIRT Viewer at http://192.168.255.2:8080/birt.

Deploying Reports

Once the BIRT Viewer is working, you can now copy reports to the server anywhere under the /var/lib/tomcat5/webapps/birt directory and view them online through the URL http://192.168.255.2:8080/birt/frameset?__report=whatever.rptdesign. I usually put all reports under the existing /var/lib/tomcat5/webapps/report directory and then access the report through http://192.168.255.2:8080/birt/frameset?__report=report/whatever.rptdesign.

Enabling JDBC Access

If the data of your reports is located in a database, you will need to install the appropriate JDBC driver for BIRT. I'll use MySQL for this example.

You can get the MySQL JDBC driver from here.

Once the download is finished, copy the mysql-connector-java-3.1.14-bin.jar file to BIRT:

# tar xzvf mysql-connector-java-3.1.14.tar.gz
# cd mysql-connector-java-3.1.14
# cp mysql-connector-java-3.1.14-bin.jar /var/lib/tomcat5/webapps/birt/WEB-INF/platform/plugin/org.eclipse.birt.report.data.oda.jdbc_2.6.2.r262_v20110127/drivers/

Note, depending on the version of BIRT being used, the actual destination directory could be different. I use the following method to find the right destination:

# find /var/lib/tomcat5/webapps/birt -iname \*jdbc\*

Conclusion

This article covered an alternative configuration to the article Deploying BIRT on JBoss by using Tomcat instead of JBoss.