cancel
Showing results for 
Search instead for 
Did you mean: 

jsf reportPageViewer displays blank

Former Member
0 Kudos

Hi there,

For the last week I've been struggling to try to implement a crystal report viewer in my jsf webapp.

My environment is crystal reports 2011 processing server and report application server 2011, and the version of BO is SAP BusinessObjects Enterprise XI 4.0

The implementation of jsf being used is sun faces 2.2.5.

At one point I was able to get my project error-free, but it resulted in just a blank page (other than other html output).

In reading through the xi4_rasjava_dg_en developer guide, I know i need to

  • 1.Copy the required JAR files into your web application.
  • 2.Deploy the CrystalReports.war file with your web application.
  • 3.Edit your web.xml file.


1. I have the appropriate com.crystaldecisions jars (which are imported via maven dependency declarations),

2. I can't seem to find the crystalreports.war (the dev guide said \Program Files\Business Objects\BusinessObjects Enterprise 12.0\java\applications on Windows).  My local installation doesn't have a java folder, and I'm told that the serverside installation does have a java folder but doesn't have any war files.

3. My web.xml looks like this:


<servlet>

        <servlet-name>Faces Servlet</servlet-name>

        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <context-param>

        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>

        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

        <param-value>server</param-value>

    </context-param>

    <context-param>

        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

        <param-value>.xhtml</param-value>

    </context-param>

    <context-param>

        <param-name>javax.faces.PROJECT_STAGE</param-name>

        <param-value>Development</param-value>

    </context-param>

    <context-param>

    <param-name>crystal_image_uri</param-name>

    <param-value>crystalreportviewers</param-value>

    </context-param>

    <context-param>

    <param-name>crystal_image_use_relative</param-name>

    <param-value>webapp</param-value>

    </context-param>

There is also mention of a crystalreportviewers folder to be placed parallel to the WEB-INF folder, but I haven't figured out what it is for, other than "contains the support files required by the viewers."  It does seem to be referenced as the crystal_image_uri though.

My JSF xhtml file contains this:


<h:body>

    <!--ui:include src="header.xhtml" /-->

    <f:view>

        <h:form id="viewerForm">

            Test

            <bocrv:reportPageViewer viewerName="CrystalViewer"

            reportSource="#{reports.reportSource}"

            displayToolbarRefreshButton="false"

            allowDatabaseLogonPrompting="false"

            allowParameterPrompting="false"

            displayGroupTree="false"

            displayToolbarLogo="false"

            displayToolbarToggleTreeButton="false"

            enablePageToGrow="false" height="540"

            zoomPercentage="100" width="750"

            allowDrillDown="false"

            displayToolbarPrintButton="true"

            printMode="#{reports.printMode}"

            ></bocrv:reportPageViewer>

            Test2

        </h:form>

    </f:view>

    <!--ui:include src="footer.xhtml" /-->

</h:body>

And the Reports.java backing bean includes:


public Reports() throws IOException, SDKException

    {

        LOGGER.info("Reports()");

        setPrintMode(CrPrintMode.fromString("ActiveX"));

        setReportSource(getManagedReportSource("S0010_HHR_A_Transfer_Details"));

    }

    //endregion

    IReportSource getManagedReportSource(String reportName) throws SDKException, IOException

    {

        LOGGER.info("username: hhrpt, password: handheld, CMS: berlin-b, service: secEnterprise");

        IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon("username", "pass", "server", "secEnterprise");

        IReportSourceFactory reportSourceFactory = (IReportSourceFactory) enterpriseSession.getService("", "PSReportFactory");

        IInfoStore infostore = (IInfoStore) enterpriseSession.getService("InfoStore");

        IInfoObjects reports = infostore.query("Select SI_ID, SI_CUID From CI_INFOOBJECTS Where SI_NAME='" + reportName + "' And SI_INSTANCE=0");

        IInfoObject report = (IInfoObject)reports.get(0);

        LOGGER.info("CUID of report: " + report.getCUID());

        String reportID = "cecuid:///" + report.getCUID() + "";

        IReportSource reportSource = reportSourceFactory.openReportSource(reportID, java.util.Locale.ENGLISH);

        if(reportSource != null)

        {

            LOGGER.info("report source found");

        }

        return reportSource;

    }

which at one point i was able to see successfully get the CIUD and the reportsource.

However, I'm thinking my main problem might be not having a CrystalReports.war....if I can't seem to locate it, where else should I be able to get it?

Is there anything else I'm clearly doing wrong?  It seems difficult to find information or examples on successful implementations of a crystal report viewer in a jsf webapp.

Thanks,

Jeremy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jeremy,

You would need to refer to the 'Configuring your web.xml file' section of the developers guide for SAP BusinessObjects Enterprise XI 4.0 available at below link

http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_boejava_dg_en.zip

You would specifically need to look at the JSF section.

Construct an web.xml based on the example given in the developer guide.

Also, you do not need a CrystalReport.war file deployed on your developer environment.

If you have client tools installed on your development environment, you can get the required jars from the following location

C:\Program Files (x86)\SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\java\lib

C:\Program Files (x86)\SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\java\lib\external

If you do not have ClientTools installed, you can get the jars from the Server machine which will be available at the same location.

You would need to have the crystal report virwer in your application context as it has all the viewer comonents, You can find it on the server machine at the below location

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports

Thanks,

Prithvi

Former Member
0 Kudos

Thanks Prithviraj,

Good to know the war is not required.  I do have the jars from the lib and lib/external, in the form of maven dependencies.

My Business Intelligence team reports that there is a “crystalreportviewers” folder on the servers under D:\Program Files (x86)\SAP BusinessObjects\Crystal Reports 2011.

Will I need all the files in that folder?

As for the web.xml, one difference I have with it is that instead of

<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
I have
<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.xhtml</url-pattern>


Is that an important difference?

I was also missing a crystalreportviewerservlet which I've now corrected.  Once I get the folder from the server, I'll try my project again.

Jeremy

Former Member
0 Kudos

Hi Jeremy,

You would require the entire crystalreportviewers folder in your application context.

It contains the relavent files to invoke the viewer component.

Regarding the Url-Pattern, as far as I am aware of it should not make a difference. You can use <url-pattern>*.xhtml</url-pattern>


Thanks,

Prithvi

Former Member
0 Kudos

It doesn't seem to work,...I didn't think windows dlls would help much in a java tomcat environment.  Here's what the project structure looks like with it there.

When the xhtml page loads, via this code:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html

        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:p="http://primefaces.org/ui"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:bocrv="http://www.businessobjects.com/jsf/crystalreportsviewers">

<h:body>

    <ui:include src="header.xhtml" />

    <f:view>

        report viewer goes here:

        <h:form id="reportviewer">

            <bocrv:reportPageViewer viewerName="CrystalViewer"

                    reportSource="#{reports.reportSource}"

                    displayToolbarRefreshButton="false"

                    allowDatabaseLogonPrompting="false"

                    allowParameterPrompting="false"

                    displayGroupTree="false"

                    displayToolbarLogo="false"

                    displayToolbarToggleTreeButton="false"

                    enablePageToGrow="false" height="540"

                    zoomPercentage="100" width="750"

                    allowDrillDown="false"

                    displayToolbarPrintButton="true"

                    printMode="#{reports.printMode}"

                    />

            ^

        </h:form>

A message is displayed: Warning: This page calls for XML namespace http://www.businessobjects.com/jsf/crystalreportsviewers declared with prefix bocrv but no taglibrary exists for that namespace.

Of course, this should be finding the jsfviewer.tld in the webreporting-jsf.jar.

The end result is a blank space after the "report viewer goes here" text.

Am I missing anything else?

Former Member
0 Kudos

In the past, others have suggested that one needs to create a faclets-taglib manually... is that correct, or should the one in webreporting-jsf be found.

Former Member
0 Kudos

I did end up creating my own taglib, and extending UIReportPageViewer and ViewerHtmlRenderer, like in
Now, it appears the reportviewer is coming up, which is AWESOME, after 2 weeks of struggles.  However, when it asks for parameters, the OK button to submit them doesn't do anything when pressed.   At this point since I'm not getting any replies, I'm just updating this in case others have the same issues.