Jump to content
Changes to the Jaspersoft community edition download ×

NoClassDefFoundError


Recommended Posts

By: Glen Fafara - intrinsicsys

NoClassDefFoundError

2003-11-04 12:43

I am trying to use JasperReports from a servlet running on Tomcat 4.1.27 getting data from a Postgres database, and I get the following errors.

 

Any advice is welcome.

 

Thanks

 

Glen

 

 

root cause

 

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at dori.jasper.engine.util.JRLoader.(JRLoader.java:100)

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:157)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:666)

at XLUserDetailReportServlet.doGet(XLUserDetailReportServlet.java:82)

 

 

If I refresh the page I get the followng error:

 

root cause

 

java.lang.NoClassDefFoundError

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:157)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:666)

at XLUserDetailReportServlet.doGet(XLUserDetailReportServlet.java:82)

 

 

Here is my servlet

 

 

 

 

import java.sql.*;

import dori.jasper.engine.*;

import dori.jasper.view.*;

 

public class XLUserDetailReportServlet extends HttpServlet

{

Map parameters = new HashMap();

parameters.put("ReportTitle", "XL User Detail Report");

try

{

Class.forName("org.postgresql.Driver");

}

catch (Exception e)

{

httpResponseCode = HttpServletResponse.SC_BAD_GATEWAY;

}

try

{

String url = "jdbc:postgresql:XL";

String user = "", pass = "";

Connection conn = DriverManager.getConnection(url, user, pass);

JasperPrint jp = JasperManager.fillReport("/var/www/reports/XL_User_Detail_Report.jasper", parameters, conn);

byte buf[] = JasperExportManager.exportReportToPdf(jp);

response.setContentType("application/pdf");

response.setContentLength(buf.length);

response.setHeader("content-disposition", "inline; filename=OpenActionItems.pdf");

 

OutputStream out = response.getOutputStream();

out.write(buf, 0, buf.length);

out.close();

if (conn != null) conn.close();

}

catch (Exception e)

{

e.printStackTrace();

System.err.println("RptOpenActionItemHandler: " + e);

}

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...