Skip to Content
0
Former Member
Mar 17, 2009 at 05:06 AM

Crystal Reports for eclipse 2.0 deployed on unix

78 Views

Hi,

We have designed few crystal reports using u201CCrystal Reports for Eclipse 2.0u201D on windows platform. We have embedded this report into a J2EE Web application and deployed the web application on Tomcat 6.X server.

We are able to generate the reports successfully on windows environment. But when deployed the web Application on to Tomcat server 6.X on Solaris environment we get runtime exception as below.

com.crystaldecisions.sdk.occa.report.lib.ReportSDKClientDocException: The document has not been opened.---- Error code:-2147215349.

It is failing at At clientDoc.open(reportName, OpenReportOptions._openAsReadOnly) of the JSP whaich was shared where clientDoc is an object of ReportClientDocument. That is it is failing to open the .rpt.

The eclipse generated JSP used to invoke the report sa follows.

<%@ page contentType="text/html; charset=iso-8859-1" pageEncoding="ISO-8859-1" %><%@ page import="com.businessobjects.samples.CRJavaHelper,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,

com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,

com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,

java.util.Calendar,

java.util.Date,

java.text.DateFormat,

java.text.SimpleDateFormat" %><%

// This sample code calls methods from the CRJavaHelper class, which

// contains examples of how to use the BusinessObjects APIs. You are free to

// modify and distribute the source code contained in the CRJavaHelper class.

try {

HttpSession sessionObj = request.getSession();

String reportName = "reports/EmailDataReport.rpt";

String attStartDate = (String)sessionObj.getAttribute("CalendarStartDate");

String attEndDate = (String)sessionObj.getAttribute("CalendarEndDate");

//attStartDate = "2/12/2004";

//attEndDate = "2/17/2009";

// spliting the start and end date

String [] arrStDate = null;

String [] arrEndDate = null;

arrStDate = attStartDate.split("/");

arrEndDate = attEndDate.split("/");

ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

if (clientDoc == null) {

// Report can be opened from the relative location specified in the CRConfig.xml, or the report location

// tag can be removed to open the reports as Java resources or using an absolute path

// (absolute path not recommended for Web applications).

clientDoc = new ReportClientDocument();

try{

clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

// Open report

clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

//DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

}catch(Exception e){

out.println(" -


Error while opening the report $$$$$$$$$$$"e.toString()"\n");

}

// ****** BEGIN SET RUNTIME DATABASE CREDENTIALS ****************

{

String connectString = "XXXXXX

String driverName = "oracle.jdbc.OracleDriver";

String JNDIName = "";

String userName = "YYYYY"; // TODO: Fill in database user

String password = "ZZZZZZZZZ"; // TODO: Fill in password

// Switch all tables on the main report and sub reports

CRJavaHelper.changeDataSource(clientDoc,reportName,null,userName, password, connectString, driverName, JNDIName);

// logon to database

CRJavaHelper.logonDataSource(clientDoc, userName, password);

}

// ****** END SET RUNTIME DATABASE CREDENTIALS ****************

// ****** BEGIN CONNECT PARAMETERS SNIPPET ****************

{

// DATE VALUE PARAMETER.

Calendar calendar = Calendar.getInstance();

calendar.set(Integer.parseInt(arrStDate[2]), Integer.parseInt(arrStDate[0])-1, Integer.parseInt(arrStDate[1]));

Date dateParamVal = calendar.getTime(); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "StartDate", dateParamVal);

}

{

// DATE VALUE PARAMETER.

Calendar calendar = Calendar.getInstance();

calendar.set(Integer.parseInt(arrEndDate[2]), Integer.parseInt(arrEndDate[0])-1, Integer.parseInt(arrEndDate[1]));

Date dateParamVal = calendar.getTime(); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "EndDate", dateParamVal);

}

// ****** END CONNECT PARAMETERS SNIPPET ****************

// Store the report document in session

session.setAttribute(reportName, clientDoc);

}

// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

{

// Create the CrystalReportViewer object

CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

String reportSourceSessionKey = reportName+"ReportSource";

Object reportSource = session.getAttribute(reportSourceSessionKey);

if (reportSource == null)

{

reportSource = clientDoc.getReportSource();

session.setAttribute(reportSourceSessionKey, reportSource);

}

// set the reportsource property of the viewer

crystalReportPageViewer.setReportSource(reportSource);

// Apply the viewer preference attributes

// Process the report

crystalReportPageViewer.processHttpRequest(request, response, application, null);

}

// ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

} catch (ReportSDKExceptionBase e) {

out.println(e);

}

%>

Note : We have not installed any crystal report servers in both windows or UNIX environment.But we have deployed all the relavant crystal report jars for the java runtime environment.

If anyone has come across such error please help. Also let me know if we need to have external RAS set up for this?By default the the RAS will be set to "inproc:jrc" which works fine on windows environment.

regards,

Madhu