Quantcast
Channel: SCN : Popular Discussions - SAP Crystal Reports, version for Eclipse
Viewing all articles
Browse latest Browse all 893

Error: The report source could not be retrieved from the state object.

$
0
0

I have been trying to create a report in a JSF page. The relevant parts are below:

 

Inside the JSP page, this is the code:

 

              <jsp:useBean id="MyBean" class="com.nm.facade.rto.POJOViewerBean" scope="session" />                <jsp:setProperty name="MyBean" property="reportLocation" value="Report1.rpt" />               <v:reportPageViewer reportSource="#{MyBean.reportSource}"                                       displayToolbarPrintButton="true"                                       printMode="ActiveX"                                       zoomPercentage="100"                                       displayToolbarExportButton="true"                                       displayToolbarRefreshButton="true"                                       viewerName="My Viewer"               ></v:reportPageViewer>

 

In the backing bean, this is the relevant code:

 

    public Object getReportSource() throws ReportSDKException    {        if (propertiesChanged || reportSource == null)        {            propertiesChanged = false;                        if (reportLocation == null)            {                throw new RuntimeException("The reportLocation property must be set before a report source is retrieved");            }                             ReportClientDocument rcd = new ReportClientDocument();            rcd.setReportAppServer(ReportClientDocument.inprocConnectionString);            rcd.open(reportLocation, 0);            DatabaseController dbc = rcd.getDatabaseController();            //Create the POJO collection and populate it with data            ReportData[] data =            {              new ReportData("B.B.", "King", 6, new Date(25, 9, 16)),                new ReportData("Muddy", "Waters", 7, new Date(15, 4, 4)),                new ReportData("John Lee", "Hooker", 8, new Date(16, 8, 16)),                new ReportData("Otis", "Rush", 9, new Date(34, 4, 29)),                new ReportData("Buddy", "Guy", 10, new Date(36, 7, 30))            };            //Create the result set from the collection of POJOs            POJOResultSetFactory factory = new POJOResultSetFactory(ReportData.class);            factory.setVerbose(true);            POJOResultSet results = factory.createResultSet(data);            ResultSetMetaData metaData = results.getMetaData();            //Set the resultset as the report datasource                  //Get the table name from the 'Set Datasource Location' dialog in the Crystal Reports designer            String reportTable = "getReportDataDataSource";            dbc.setDataSource(results, reportTable, reportTable);                    IReportSource reportSource = rcd.getReportSource();                        if (reportSource == null)            {                throw new RuntimeException("Unable to get a report source.");            }        }                return reportSource;    }

 

In the CRConfig.xml, this is what is there:

 

<?xml version="1.0" encoding="utf-8"?><CrystalReportEngine-configuration>    <reportlocation>../reports</reportlocation>    <timeout>0</timeout>    <ExternalFunctionLibraryClassNames>         <classname></classname>    </ExternalFunctionLibraryClassNames></CrystalReportEngine-configuration>

 

The report template 'Report1.rpt' is packaged under WEB-INF/reports in the war file.

 

When I try to generate the report by accessing the JSF page, I am getting an error: "The report source could not be retrieved from the state object. "

 

I am not sure what is wrong. Can someone help me in resolving this issue?

 

Edited by: renshai on Jul 9, 2009 3:21 AM


Viewing all articles
Browse latest Browse all 893

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>