We have a very simple requirement to integrate CR within our web application. Our server side code is based on the Java platform (Struts/Spring/Hibernate). As a first iteration we want to simply use a pre-generated RPT file (itu2019s not even dependent on any DB right now) to render a report in a HTML page.
As of now we are just using an action class that creates a ReportClientDocument object, opens the RPT file, stores the object as a request attribute and forwards it to a JSP page for rendering. Much of the code is really a cut-n-paste job from the sample codes in the dev guide documentation. Below is the crux of the action class:
final String REPORT_NAME = "/info/ADTestReport1.rpt";
public ActionForward execute(ActionMapping pMapping,
ActionForm pForm,
HttpServletRequest pRequest,
HttpServletResponse pResponse) throws ReportSDKException{
ReportClientDocument rcd = new ReportClientDocument();
//rcd.setReportAppServer(ReportClientDocument.inprocConnectionString);
rcd.open(REPORT_NAME, 0);
pRequest.setAttribute("ReportSource", rcd.getReportSource());
return pMapping.findForward("success");
}
On successful execution, as is obvious from the above code, it forwards the request to a logical mapping called u201Csuccessu201D that points to the view component a JSP file. The JSP file is an exact copy of the sample code provided in dev guide except for the fact that instead of accessing the forwarded source object from session object we are accessing it from request object.
<%@ page contentType="text/html; charset=utf-8"
import="com.crystaldecisions.report.web.viewer.CrystalImageCleaner,
com.crystaldecisions.report.web.viewer.CrystalReportViewer,
com.crystaldecisions.report.web.viewer.CrPrintMode"
%><%
Object reportSource;
CrystalReportViewer crystalReportViewer;
/*
Retrieve ReportSource from HTTP Session and pass to CrystalReportViewer.
*/
//reportSource = session.getAttribute("ReportSource");
reportSource = request.getAttribute("ReportSource");
crystalReportViewer = new CrystalReportViewer();
crystalReportViewer.setOwnPage(true);
crystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
crystalReportViewer.setReportSource(reportSource);
crystalReportViewer.processHttpRequest(request, response, getServletContext(), null);
%><%!
/*
Start image clieanup thread on JSP load.
Scan temp folder every 10 minutes to delete viewer-generated images 20 minutes or older.
*/
public void jspInit() {
CrystalImageCleaner.start(getServletContext(), 10 * (60 * 1000), 20 * (60 * 1000));
}
/*
Stop the image cleanup thread on JSP unload.
*/
public void jspDestroy() {
CrystalImageCleaner.stop(getServletContext());
}
%>
The above is essentially the whole solution that we are using to get the RPT file and render a crystal report within a HTML page. However, the code throws the following exception at the point it tries to instantiate a ReportClientDocument object.
2010-12-06 11:19:10,325 ERROR org.apache.catalina.core.StandardWrapperValve.invoke - Servlet.service() for servlet action threw exception
java.lang.NoClassDefFoundError: com/businessobjects/foundation/logging/LoggerManager
at com.crystaldecisions.xml.serialization.CrystalSAXParserHandler.<clinit>(SourceFile:44)
at com.crystaldecisions.xml.serialization.XMLObjectSerializer.<init>(SourceFile:42)
at com.crystaldecisions.proxy.remoteagent.ClientSDKOptions.readClientSDKOptions(SourceFile:147)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.n(SourceFile:1129)
This obviously points to a dependency on a class com.businessobjects.foundation.logging.LoggerManager class that doesnu2019t exist in the SDK. Has anyone faced this situation? Or can anyone help us in understanding the problem and what we need to do to rectify this issue?
Much thanks in advance.