cancel
Showing results for 
Search instead for 
Did you mean: 

crystal report setCommunicationAdapter error

Former Member
0 Kudos

Hi All, with the below code, i am getting the error:

javax.servlet.ServletException: java.lang.NoSuchMethodError: com.crystaldecisions.sdk.occa.report.application.ReportAppSession.setCommunicationAdapter(Lcom/crystaldecisions/proxy/remoteagent/ICommunicationAdapter;)V

code: 

<%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.*"%>
<%@ page import="com.crystaldecisions.sdk.framework.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.managedreports.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>






<%
/* 	String username = "Administrator";
	String password = "";
	String cmsname = "localhost:6400";
	String Authen = "secEnterprise"; */
	
	String cmsname = "xxx"; //  name of crystal server
	String username = "xx";
	String password = "xxx";
	String Authen = "xx";
	String sReportName = "xxx";


	//connecting to Enterprise
	IEnterpriseSession es = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, Authen);


	//get the report App Factory form the Crystal Enterprise
	IReportAppFactory appFactory = (IReportAppFactory) es.getService("", "RASReportService");
	//IReportSourceFactory appFactory = (IReportSourceFactory) es.getService("PSReportFactory");


	//get the infostore service form the Crystal Enterprise
	IInfoStore istore = (IInfoStore) es.getService("", "InfoStore");
	
	


	//get the report by name from crystal Enterprise
	IInfoObjects iobjects = istore
			.query("Select * From CI_INFOOBJECTS Where SI_NAME = 'xxx' and SI_INSTANCE = 0 ");


	//open the report in the report doc object.
	ReportClientDocument Doc = appFactory.openDocument((IInfoObject) iobjects.get(0), 0, Locale.ENGLISH);


	// WORKING WITH THE PRINT OUTPUT CONTROLLER


	//Use the report documents PrintOutputController to export the report to a ByteArrayInputStream
	ByteArrayInputStream byteIS = (ByteArrayInputStream) Doc.getPrintOutputController()
			.export(ReportExportFormat.recordToMSExcel);


	// EXPORTING THE REPORT
	//Create a byte[] (same size as the exported ByteArrayInputStream)


	byte[] buf = new byte[2000 * 1024];
	int nRead = 0;


	//Set response headers to indicate pdf MIME type and inline file
	response.reset();
	response.setHeader("Content-disposition", "inline;filename=ramz");
	response.setContentType("application/xls"); 


	//Send the Byte Array to the Client
	while ((nRead = byteIS.read(buf)) != -1) {
		response.getOutputStream().write(buf, 0, nRead);
	}


	//Flush the output stream
	response.getOutputStream().flush();
	//Close the output stream
	response.getOutputStream().close();
%>




May i know what might be the problem? if jars, can you post what all jars neneeded?

Accepted Solutions (0)

Answers (0)