---
title: "[转载]Installing the BIRT Viewer in Tomcat"
author: "dodoflying"
date: "2007-04-20T15:50:59Z"
tags: []
slug: "installing-the-birt-viewer-in-tomcat"
draft: false
lastmod: "2007-04-20T15:50:59Z"
id: 72872
url: "https://dodoflying.iteye.com/blog/72872"
---

from  
http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php

## Using Tomcat

This page explains how to deploy the BIRT viewer to a J2EE container. We'll use [Apache Tomcat](http://jakarta.apache.org/tomcat/), since it is open source and readily available. The same concepts, perhaps with different details, apply to other app servers. These instructions assume you'll install Tomcat on your own machine using the default port number of 8080.

If you don’t have Tomcat installed on your system you can download it from [http://jakarta.apache.org/tomcat](http://jakarta.apache.org/tomcat). BIRT works with the 4.1.x and 5.5.x verisons of Tomcat.

## [Install the Viewer]()

[Deploy the BIRT Viewer application. Follow these steps:]()

- [Download the zip file with the BIRT report engine runtime. The file is named birt-runtime-version#.zip. Unzip the file in a staging area. Look under the birt-runtime- Copy the Web Viewer Example directory（我使用的是birt-runtime-2.1.2版本，目录名是WebViewerExample） to the webapps directory of your Tomcat installation. For ease of reference, rename the directory to "birt-viewer". Copy additional files to the directory structure described in the BIRT Runtime Note below (iText and prototype.js).向下面看 Stop, then restart Tomcat.]()
- [Display the Tomcat manager application to check that the viewer is deployed:]() [http://localhost:8080/manager/html](http://localhost:8080/manager/html).
- Verify that birt-viewer is listed as an application, then click on the birt-viewer link.
- A page confirming that the BIRT viewer has been installed should be displayed. Click on the link labeled "View Example" to confirm that your installation is working properly.

If you choose to put the Viewer into some other location, you'll need to use a context entry within the server.xml file to indicate the deployment location. See Tomcat documentation for details.

### Birt 2.1 Note:

- If you are installing BIRT 2.1 or later the Web Viewer Example has been renamed to WebViewerExample.

## [iText and prototype.js]()

[]()

[Verify that you have downloaded]() [iText 1.3](http://prdownloads.sourceforge.net/itext/itext-1.3.jar) and [prototype.js v1.4.0](http://dev.conio.net/repos/prototype/dist/prototype.js)(only required for BIRT 2.0.2 and earlier builds) and follow the note below:

### Birt 2.0.2 Runtime Note:

- If you are installing the BIRT 2.0.2 Runtime (J2EE Application Server Deployment), The iText and prototype files will need to be copied to the birt-runtime/Web Viewer Example directory structure.
- Copy [itext-1.3.jar](http://prdownloads.sourceforge.net/itext/itext-1.3.jar) to /Web Viewer Example/plugins/org.eclipse.birt.report.engine.emitter.pdf/lib.
- Copy [prototype.js v1.4.0](http://dev.conio.net/repos/prototype/dist/prototype.js) to /Web Viewer Example/ajax/lib.

### Birt 2.1 Runtime Note:

- If you are installing the BIRT 2.1 Runtime (J2EE Application Server Deployment), The iText file will need to be copied to the birt-runtime/WebViewerExample directory structure.
- Copy [itext-1.3.jar](http://prdownloads.sourceforge.net/itext/itext-1.3.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.

### Birt 2.1.1 Runtime Note:（我使用2.1.2 Runtime）

- If you are installing the BIRT 2.1.1. or 2.1.2 Runtime (J2EE Application Server Deployment),
- Copy [itext-1.3.jar](http://prdownloads.sourceforge.net/itext/itext-1.3.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.
- Copy [iTextAsian.jar](http://prdownloads.sourceforge.net/itext/iTextAsian.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.

### Birt 2.2M2 Runtime Note:

- If you are installing the BIRT 2.2M2 or later Runtime (J2EE Application Server Deployment),
- Copy [itext-1.4.6.jar](http://prdownloads.sourceforge.net/itext/itext-1.4.6.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.
- Copy [iTextAsian.jar](http://prdownloads.sourceforge.net/itext/iTextAsian.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.

## [Install your JDBC Drivers]()

Add the jar files for your JDBC drivers to the Viewer. Copy the driver the following directory:

### Birt 2.0.2 Note:

- If you are installing BIRT 2.0.2 or earlier the driver needs to be copied to birt-viewer/plugins/org.eclipse.birt.report.data.oda.jdbc/drivers.

### Birt 2.1 Note:

- If you are installing BIRT 2.1 or later the driver needs to be copied to birt-viewer\\WEB-INF\\platform\\plugins\\org.eclipse.birt.report.data.oda.jdbc \\drivers.（实际情况和

org.eclipse.birt.report.data.oda.jdbc这个名字不太相同

- ）

## [Testing a More Complex Report]()

We'll test the viewer further using one of the example reports created for the "Classic Models" database. Note that Classic Models database is included in the birt runtime distribution so no further set-up is required. Follow these steps:

- Download the zip file with the BIRT report engine runtime. The file is named birt-runtime-
- Click on the following link to download the example report design, [SalesInvoice.rptdesign](http://www.eclipse.org/birt/phoenix/examples/solution/SalesInvoice.rptdesign) into another browser window. Use the "Save as..." command from the file menu to save the report into the birt-viewer/report directory.
- If you've installed everything in its default location, then click on the following link. If you've changed anything, then copy the following URL into your browser and make the needed changes.
  
  > http://localhost:8080/birt-viewer/run?\_\_report=Report\\SalesInvoice.rptdesign
  
  or
  
  > http://localhost:8080/birt-viewer/frameset?\_\_report=Report\\SalesInvoice.rptdesign
  
  The report should run and appear in your browser. See [Viewer Usage](http://www.eclipse.org/birt/phoenix/deploy/viewerUsage.php) for information on the Viewer Operations.

## [Deploying to JBoss]()

To deploy the BIRT Viewer application to JBoss, follow these steps:

- Download the zip file with the BIRT report engine runtime. The file is named birt-runtime-version#.zip.
- Unzip the file in a staging area.
- Look under the birt-runtime-
- Copy the "Web Viewer Example" directory to your JBoss installation, under the deploy directory for your configuration. (eg) C:\\jboss-4.0.3SP1\\server\\default\\deploy.
- Rename the Web Viewer Example directory to birt.war, so it will deploy in place.
- Copy [itext-1.3.jar (BIRT 2.1)](http://prdownloads.sourceforge.net/itext/itext-1.3.jar) or [itext-1.4.6.jar (BIRT 2.2)](http://prdownloads.sourceforge.net/itext/itext-1.4.6.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.
- (BIRT 2.1.1 or later) Copy [iTextAsian.jar](http://prdownloads.sourceforge.net/itext/iTextAsian.jar) to /WebViewerExample/WEB-INF/platform/plugins/com.lowagie.itext/lib.
- Start up JBoss and enter the URL to BIRT (ie http://localhost:8080/birt) and run the test report..

## [Other J2EE Servers]()

We are currently working on instructions for other application servers