RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


The Low-Cost Solution for Serving Crystal Reports from a Java Server : Page 3

Delivering Crystal Reports on the Web via commercial platforms can be pricey. The Crystal Reports Java Reporting Component library offers a cheaper solution: deploying Crystal Reports as a component on an open source Java Web server.


Deploy the Application

No J2EE/Java EE application would be complete without packing and deployment procedures. You will package the sample application as a simple WAR file, but you could easily toss it into an EAR if your application server requires it.

The Web Archive
Create a Java WAR file or Web application directory structure according to the standard setup for a Java Web application. Place the JSP file you created earlier in the root of the app, and set up a web.xml file inside the WEB-INF directory and a lib folder within WEB-INF.

Required JAR Files
Several JAR files need to be available to your Web application at runtime (typically via the Web app's lib directory). Copy all the files from the lib directory of Crystal's Java folder (identified under ‘Crystal setup') to your Web app (probably the lib directory). Then copy Concurrent.jar, icu4j.jar, log4j.jar, xercesImpl.jar, and xml-apis.jar from the java/lib/ext directory. Finally, copy the database driver JAR file to the same location.

Crystal Viewer Files
Crystal comes with a set of ActiveX and DHTML report viewer files that your application will need to access. You can find this folder at the Crystal Report base directory (identified under ‘Crystal setup') under the name crystalreportviewers10 (Crystal X), crystalreportviewers11 (Crystal XI), or crystalreportviewers115 (Crystal XI Release 2). Copy this folder and its contents to the root of your Web application directory.

You must define a context parameter within web.xml to indicate where the Crystal viewer files can be located. This parameter assumes the root of your application as the base context. Thus, for this simple example, you simply need to declare the folder name as the location:


Application Deployment
With the application complete, you are ready to deploy it to a Java Web server. If you don't already have one selected, Apache Tomcat is an excellent—and free—choice.

Once deployed, fire up the Web server and then browse to the application and test the report via your handy-dandy Web browser.

Crystallize Your Web Reporting

Visibility into real-time data is a critical aspect of enterprise information systems. Crystal Reports provides a very mature and capable solution for report generation and formatting, but its server-based solutions can be to work with difficult and expensive. If you need to Web-enable one or more Crystal reports, the J2EE/Java EE platform provides a capable and powerful mechanism to accomplish this.

Kyle Gabhart serves as the SOA Practice Lead for Web Age Solutions, a provider of technology education and mentoring. Since 2001 he has contributed extensively to the SOA/web services body of knowledge as an author, speaker, consultant, and open source contributor. Find Kyle on the Web at http://www.gabhart.com or reads his blog on SOA at SOAmatters.com.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date