Jump to content
Changes to the Jaspersoft community edition download ×

having problems to generate pdf in struts app

Recommended Posts

By: Honghai Zhang - haroldzhang

having problems to generate pdf in struts app

2003-12-09 09:55



I want to use jasper reports to generate pdf in a struts action class.

Here is the code segment


try {

JasperCompileManager.compileReportToFile(fileName + ".xml");

Map parameters = new HashMap();

JasperRunManager.runReportToPdfFile(fileName + ".jasper", parameters, new JREmptyDataSource());

_log.debug("fileName: " + fileName + ".xml");


catch (JRException e) {




try {

// hard coded for demo

InputStream content = new FileInputStream(fileName + ".pdf");


// XXX Need to buffer this a little.

int b;

while( (b = content.read()) != -1 ) {

outputStream.write( b );




} catch( java.io.IOException e ) {

_log.error( "error", e );




I got the following error message when I try to generate a pdf file use this struts app after I deployed it in weblogic server 6.1. Note: Although I can use jasper reports to do the same when I run it as an stand alone java app.



dori.jasper.engine.JRException: Errors were encountered when compiling report expressions class file:

/export/home/weblogic/config/hzhang/SalesOrder.java:4: package dori.jasper.engine does not exist

import dori.jasper.engine.*;


/export/home/weblogic/config/hzhang/SalesOrder.java:5: package dori.jasper.engine.fill does not exist

import dori.jasper.engine.fill.*;


/export/home/weblogic/config/hzhang/SalesOrder.java:17: cannot resolve symbol

symbol : class JRCalculator

location: class SalesOrder

public class SalesOrder extends JRCalculator


/export/home/weblogic/config/hzhang/SalesOrder.java:24: cannot resolve symbol

symbol : class JRFillParameter

location: class SalesOrder

private JRFillParameter parameter_REPORT_CONNECTION = null;


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...