cancel
Showing results for 
Search instead for 
Did you mean: 

JavaServer Faces crviewer:viewer shows error, but no error message

Former Member
0 Kudos

I'm getting an error trying to display a report in a JSP page, but without an error message. I'll explain what I've coded, first.

<br/><br/>

I have a backing bean called reportController that has a reportSource property of type com.crystaldecisions.sdk.occa.report.reportsource.IReportSource. That property is initialised with the following code:

<br/><br/>

<pre>reportSource = reportsBean.processReport()</pre>

<br/><br/>

where processReport() is:

<br/><br/>

<pre>public IReportSource processReport()

throws NullPointerException, SQLException, ReportSDKException {

IReportSource reportSource = null;

ReportClientDocument reportClientDoc = new ReportClientDocument();

reportClientDoc.open("myReport.rpt", 0);

// where my jdbc/jndi name is "jdbc/MyApp"

CRJavaHelper.changeDataSource(reportClientDoc, "MyApp");

reportSource = reportClientDoc.getReportSource();

return reportSource;

}

private static void changeDataSource(ReportClientDocument clientDoc, String jndiName)

throws ReportSDKException {

ITable origTable = null;

ITable newTable = null;

String JNDI_DATASOURCE_NAME = jndiName;

String SERVER_TYPE = "JDBC (JNDI)";

String USE_JDBC = "true";

String DATABASE_DLL = "crdb_jdbc.dll";

IConnection oldConnection = clientDoc.getDatabaseController().getDatabase().

getConnections().getConnection(0);

IConnection newConnection = (IConnection) oldConnection.clone(true);

IConnectionInfo connectionInfo = new ConnectionInfo();

PropertyBag propertyBag = new PropertyBag();

propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);

propertyBag.put("Use JDBC", USE_JDBC);

propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);

propertyBag.put("Initial Context", "/");

propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);

connectionInfo.setAttributes(propertyBag);

newConnection.setConnectionInfo(connectionInfo);

clientDoc.getDatabaseController()

.replaceConnection(oldConnection, newConnection, DBOptions._doNotVerifyDB);

Tables tables = clientDoc.getDatabaseController()

.getDatabase().getTables();

for (int i = 0; i < tables.size(); i++) {

origTable = tables.getTable(i);

newTable = (ITable) origTable.clone(true);

newTable.setQualifiedName(origTable.getAlias());

connectionInfo = newTable.getConnectionInfo();

propertyBag = new PropertyBag();

propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);

propertyBag.put("Use JDBC", USE_JDBC);

propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);

propertyBag.put("Initial Context", "/");

propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);

connectionInfo.setAttributes(propertyBag);

clientDoc.getDatabaseController().setTableLocation(origTable, newTable);

}

IStrings subNames = clientDoc.getSubreportController().getSubreportNames();

for (int subNum = 0; subNum < subNames.size(); subNum++) {

Tables tables = clientDoc.getSubreportController()

.getSubreport(subNames.getString(subNum)).getDatabaseController()

.getDatabase().getTables();

for (int i = 0; i < tables.size(); i++) {

origTable = tables.getTable(i);

newTable = (ITable) origTable.clone(true);

newTable.setQualifiedName(origTable.getAlias());

connectionInfo = newTable.getConnectionInfo();

propertyBag = new PropertyBag();

propertyBag = new PropertyBag();

propertyBag.put(PropertyBagHelper.CONNINFO_SERVER_TYPE, SERVER_TYPE);

propertyBag.put("Use JDBC", USE_JDBC);

propertyBag.put(PropertyBagHelper.CONNINFO_DATABASE_DLL, DATABASE_DLL);

propertyBag.put("Initial Context", "/");

propertyBag.put(PropertyBagHelper.JNDI_OPTIONALNAME, JNDI_DATASOURCE_NAME);

connectionInfo.setAttributes(propertyBag);

connectionInfo.setAttributes(propertyBag);

clientDoc.getSubreportController().getSubreport(subNames.getString(subNum))

.getDatabaseController()

.setTableLocation(origTable, newTable);

}

}

}</pre>

<br/><br/>

My page is:<br/>

<pre>

&lt;f:view>

&lt;crviewer:viewer displayGroupTree="false"

viewerName="CrystalViewer"

reportSourceType="reportingComponent"

displayToolbarExportButton="true"

displayToolbarPrintButton="true"

displayToolbarRefreshButton="true"

displayToolbarToggleTreeButton="false"

displayToolbarCrystalLogo="true"

top="100"

left="200"

reportSourceVar="#{reportController.reportSource}"

isOwnPage="true"

allowDatabaseLogonPrompting="false"

printMode="PDF" >

&lt;crviewer:partsViewer viewerName="CrystalPartsViewer"

reportSourceType="reportingComponent"

title="Fill to Fill Report"

numberOfRecords="10"

showHeadings="true"

showPageNavigationLinks="true"

allowParameterPrompting="false"

reportSourceVar="#{reportController.reportSource}"/>

&lt;/crviewer:viewer>

&lt;/f:view></pre>

<br/><br/>

I have my report files stored in my WEB-INF/classes folder.

<br/><br/>

But I get the following message from the viewer (html source):

<br/><br/>

<pre>

&lt;table class="crExceptionBorder" width="100%" cellspacing=1 cellpadding=0 border=0>

&lt;tr>&lt;td class="crExceptionHeader">Error&lt;/td>&lt;/tr>

&lt;tr>

&lt;td>

&lt;table width="100%" border=0 cellpadding=5 cellspacing=0>

&lt;tr>

&lt;TD class="crExceptionElement">

&lt;table border=0 cellpadding=5 cellspacing=0>

&lt;tr>&lt;td>&lt;span class="crExceptionText">&lt;/span>&lt;/td>&lt;/tr>

&lt;/table>

&lt;/td>

&lt;/tr>

&lt;/table>

&lt;/td>

&lt;/tr>

&lt;/table>

&lt;/html></pre>

<br/><br/>

I'm just trying to get this working, and I've seen the reportSource object created and modified when I debug the application. The only problem is actually displaying the report, I believe. I think I have the JSP page correct, but I can't really find any useful documentation on the JSF component and how to use each of the attributes. Anyway, I can't get any reports to show.

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Employee
Employee
0 Kudos

If you enable Log4J logging, does it show greater detail concerning the issue?

Sincerely,

Ted Ueda

Answers (0)