Hi, From My Crystal Report File I got this Error
java.lang.NoClassDefFoundError: com/crystaldecisions/reports/reportengineinterface/a/a/b
Did i miss anything to include?
My code is Like....
<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument"%>
<%@ page import="com.crystaldecisions.reports.sdk.ISubreportClientDocument"%>
<%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer" %>
<%@ page import="com.crystaldecisions.report.web.viewer.CrPrintMode"%>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.lib.*"%>
<%@ page import="com.crystaldecisions.reports.sdk.*"%>
<%
/* Applies to: XI
* Date Created: April 4, 2005
* Description: This sample demonstrates how to change table location
* at runtime for a report that contains a subreport using the
* Crystal Reports Java Reporting Component (JRC) SDK.
* Author: HP
*/
try {
//---------- Create a ReportClientDocument -------------
ReportClientDocument oReportClientDocument = new ReportClientDocument();
//---------- Set the path to the location of the report soruce -------------
//Open report.
oReportClientDocument.open("jrc_set_subreport_table_location/jrc_set_subreport_table_location.rpt", 0);
//Get the report source
Object reportSource = oReportClientDocument.getReportSource();
//Cache report source.
//This will be used by the viewer to display the desired report.
session.setAttribute("reportSource", reportSource);
//---------- Change the database connection info properties -------------
//Change the ConnectionInfo Attribute properties such as server name, connection string, connection URL
//Change the ConnectionInfo properties such as username, password
//Get the tables collection from the report to change the properties for each table
Tables oTablesCollection = (Tables)oReportClientDocument.getDatabaseController().getDatabase().getTables();
for(int i = 0;i < oTablesCollection.size();i++)
{
//get the inner propertyBag for the table
//this is where we set the new ConnectionInfo Attribute properties such as
//server name, connection string, connection URL
PropertyBag innerPropertyBagObj = oTablesCollection.getTable(i).getConnectionInfo().getAttributes();
//set the ConnectionInfo Attribute properties with their new values
innerPropertyBagObj.putStringValue("Server Name", "vancsdb02");
innerPropertyBagObj.putStringValue("Connection URL", "jdbc:microsoft:sqlserver://vancsdb02:2646");
innerPropertyBagObj.putStringValue("Connection String", "Use JDBC=b(true);Connection URL=s(jdbc:microsoft:sqlserver://vancsdb02:2646);Database Class Name=s(com.microsoft.jdbc.sqlserver.SQLServerDriver);JNDI Datasource Name=s();Server=s(vancsdb02);User ID=s(devtech);Password=;Database=s(Xtreme);Trusted_Connection=b(false);JDBC Connection String=s(!com.microsoft.jdbc.sqlserver.SQLServerDriver!jdbc:microsoft:sqlserver://vancsdb02:2646;DatabaseName={database};user={userid};password={password}!ServerType=1!QuoteChar=');Generic JDBC Driver Behavior=s(No))");
//get the outer property bag for the table
//this is where we set the ConnectionInfo properties such as username and password
//For the setTableLocation method, we will need a copy of the original table
//and a the modified table. Therefore, we get the table that contains the
//connection information to be changed and make 2 copies
ITable originalTable = oTablesCollection.getTable(i);
ITable changedTable = oTablesCollection.getTable(i);
//get the connectionInfo object and property bag that needs to be changed
IConnectionInfo changedTableConnectionInfo = changedTable.getConnectionInfo();
PropertyBag outerPropertyBagObj = changedTableConnectionInfo.getAttributes();
//set the connectionInfo's attributes to the outerPropertyBag just retrieved
//do this to ensure that changes can be made
changedTableConnectionInfo.setAttributes(outerPropertyBagObj);
//set username and password
changedTableConnectionInfo.setUserName("devtech");
changedTableConnectionInfo.setPassword("devtech");
//set the connection info to keep changes
changedTable.setConnectionInfo(changedTableConnectionInfo);
//commit the changes by calling the setTableLocation method from the Database controller
//and pass in our original table and our modified table
oReportClientDocument.getDatabaseController().setTableLocation(originalTable,changedTable);
//Alternatively, we can also set the table location at runtime with the setTableLocationEx
//method from the Database controller; the parameters of this method provide greater
//flexilbility by accepting Objects for the argument types.
//oReportClientDocument.getDatabaseController().setTableLocationEx(new Integer(i),changedTable);
}
//********************************** Subreport code here **********************************
//get the subreport
ISubreportClientDocument oSubreportClientDocument = oReportClientDocument.getSubreportController().getSubreport("SubreportA");
//Get the tables collection from the subreport to change the properties for each table
Tables oTablesCollectionSubreport = (Tables)oSubreportClientDocument.getDatabaseController().getDatabase().getTables();
for(int i = 0;i < oTablesCollectionSubreport.size();i++)
{
//get the inner propertyBag for the table
//this is where we set the new ConnectionInfo Attribute properties such as
//server name, connection string, connection URL
PropertyBag innerPropertyBagObj = oTablesCollectionSubreport.getTable(i).getConnectionInfo().getAttributes();
//set the ConnectionInfo Attribute properties with their new values
innerPropertyBagObj.putStringValue("Server Name", "vancsdb02");
innerPropertyBagObj.putStringValue("Connection URL", "jdbc:microsoft:sqlserver://vancsdb02:2646");
innerPropertyBagObj.putStringValue("Connection String", "Use JDBC=b(true);Connection URL=s(jdbc:microsoft:sqlserver://vancsdb02:2646);Database Class Name=s(com.microsoft.jdbc.sqlserver.SQLServerDriver);JNDI Datasource Name=s();Server=s(vancsdb02);User ID=s(devtech);Password=;Database=s(Xtreme);Trusted_Connection=b(false);JDBC Connection String=s(!com.microsoft.jdbc.sqlserver.SQLServerDriver!jdbc:microsoft:sqlserver://vancsdb02:2646;DatabaseName={database};user={userid};password={password}!ServerType=1!QuoteChar=');Generic JDBC Driver Behavior=s(No))");
//get the outer property bag for the table
//this is where we set the ConnectionInfo properties such as username and password
//For the setTableLocation method, we will need a copy of the original table
//and a the modified table. Therefore, we get the table that contains the
//connection information to be changed and make 2 copies
ITable originalTable = oTablesCollectionSubreport.getTable(i);
ITable changedTable = oTablesCollectionSubreport.getTable(i);
//get the connectionInfo object and property bag that needs to be changed
IConnectionInfo changedTableConnectionInfo = changedTable.getConnectionInfo();
PropertyBag outerPropertyBagObj = changedTableConnectionInfo.getAttributes();
//set the connectionInfo's attributes to the outerPropertyBag just retrieved
//do this to ensure that changes can be made
changedTableConnectionInfo.setAttributes(outerPropertyBagObj);
//set username and password
changedTableConnectionInfo.setUserName("devtech");
changedTableConnectionInfo.setPassword("devtech");
//set the connection info to keep changes
changedTable.setConnectionInfo(changedTableConnectionInfo);
///commit the changes by calling the setTableLocation method from the Database controller
//and pass in our original table and our modified table
oSubreportClientDocument.getDatabaseController().setTableLocation(originalTable,changedTable);
//Alternatively, we can also set the table location at runtime with the setTableLocationEx
//method from the Database controller; the parameters of this method provide greater
//flexilbility by accepting Objects for the argument types.
//oSubreportClientDocument.getDatabaseController().setTableLocationEx(new Integer(i),changedTable);
//***************************** End of subreport code *************************************
}
//Redirect to the viewer page to render the report
response.sendRedirect("CrystalReportViewer.jsp");
} //end try
catch(ReportSDKException sdkEx) {
out.println(sdkEx);
}
%>
and
oReportClientDocument.open("jrc_set_subreport_table_location/jrc_set_subreport_table_location.rpt", 0);
Throws the Exception.
How to solve this?
Thanks .