Solved

Java Reporting Component Help

Posted on 2006-11-17
21
2,530 Views
Last Modified: 2012-06-27
I am using JRC to export reports from my JSP web application.  

When I try to export the report I get this message:

"The report you requested requires further information."

And I am prompted with a login screen.  When I put in the user name and password the login screen appears again.

When I set exportControl.setEnableLogonPrompt(false); I get the error "Invalid Logon"

I know that my logon information is correct.  Is there any other reason why I would get this error?

Here is the code I am using:

<%@ page import="com.crystaldecisions.report.web.viewer.ReportExportControl" %>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.RTFWordExportFormatOptions" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.PDFExportFormatOptions" %>
<%@ page import="com.crystaldecisions.report.web.viewer.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*"  %>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>

<%
try{
    /*
     *Set the Parameters
    */
   
    //Fields will hold the parameters
    Fields fields = new Fields();
    //The rpid parameter
    ParameterField paramRpid = new ParameterField();
    //Each param must have the following two objects
    Values rpidValue = new Values();
    ParameterFieldDiscreteValue rpidDValue = new ParameterFieldDiscreteValue();
    //Set the parameter name and value
    paramRpid.setName("rpid");
    //empty name means the main report
    paramRpid.setReportName("");
    rpidDValue.setValue("1763");
    rpidDValue.setDescription("Report parameter Id");
    rpidValue.add(rpidDValue);
     paramRpid.setCurrentValues(rpidValue);
    fields.add(paramRpid);
   
    /*
    *End Set Parameters
    **/
   
    /**Set Database login info*/
    ConnectionInfos connInfos = new ConnectionInfos();

    IConnectionInfo connInfo = new ConnectionInfo();
    connInfo.setUserName("user");
    connInfo.setPassword("pass");
 
    connInfos.add(connInfo);
   
     /** ENd Set Database login info*/
   
      String report = "/reports/cust_emp_all.rpt";
   
      ReportClientDocument reportClientDoc = new ReportClientDocument();
     
    reportClientDoc.open(report, 0);
      
    Object reportSource = reportClientDoc.getReportSource();
   

   

    ReportExportControl exportControl = new ReportExportControl();

    exportControl.setDatabaseLogonInfos(connInfos);
   
    //Set the parameters
    exportControl.setParameterFields(fields);
    exportControl.setEnableParameterPrompt(false);
   
    //Set the Export Options
    ExportOptions exportOptions = new ExportOptions();

    exportOptions.setExportFormatType(ReportExportFormat.PDF);

    PDFExportFormatOptions pdfExpOpts = new PDFExportFormatOptions();

   
   
    exportOptions.setFormatOptions(pdfExpOpts);

    exportControl.setReportSource(reportSource);

    exportControl.setExportOptions(exportOptions);
exportControl.setEnableLogonPrompt(false);
    exportControl.setExportAsAttachment(true);

    exportControl.refresh();

    exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
} catch (Exception e) {
    out.print("EXXXXXXX:::: " + e.getMessage());
   
}
%>
0
Comment
Question by:alzoid69
  • 10
  • 7
  • 2
  • +1
21 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What versiion of Crystal?

Does the report have a subreport?

mlmcc
0
 

Author Comment

by:alzoid69
Comment Utility
The reports were created in crystal reports 9 but I am using the JRC that came with crytal 11.  

The reports has 2 sub reports

0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
You have to set the logon informtion for the subreports in addition to the main report.

Here is a link to VB.Net code that does it

http://support.businessobjects.com/library/kbase/articles/c2010275.asp

mlmcc
0
 

Author Comment

by:alzoid69
Comment Utility
I will try to figure out how to set the password for the sub reports in Java but the documentation says this:

"If only one ConnectionInfo object is added to the ConnectionInfos collection, then the user name and password stored in that ConnectionInfo object is applied to all connections, including embedded subreports and on-demand subreports."

0
 

Author Comment

by:alzoid69
Comment Utility
I removed the subreports from the main report and I still get the Logon Failed error
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
It may say that but my experience and the questions on this site indicate otherwise.

Do you have permissions?

You might try moving this line up
exportControl.setReportSource(reportSource);


Make it the first line after
ReportExportControl exportControl = new ReportExportControl();


mlmcc
0
 

Author Comment

by:alzoid69
Comment Utility
I created a new report and started to ad in different elements to see what is causing the error.  

Once I added a parameter fields to the report it would not export.  I copied the code from the developer manual that came with the download for setting parameter fields and I still get the error.


Here is my code:

<%
try{
   
    /**Set Database login info*/
    ConnectionInfos connInfos = new ConnectionInfos();

    IConnectionInfo connInfo = new ConnectionInfo();
    connInfo.setUserName("ppmuser");
    connInfo.setPassword("ppmauditdb");
   
 
    connInfos.add(connInfo);
   
     /** ENd Set Database login info*/
   
    String report = "/reports/test.rpt";
   
    ReportClientDocument reportClientDoc = new ReportClientDocument();

    reportClientDoc.open(report, 0);
      
    Object reportSource = reportClientDoc.getReportSource();

    ReportExportControl exportControl = new ReportExportControl();

    exportControl.setReportSource(reportSource);
   
    exportControl.setDatabaseLogonInfos(connInfos);
   
//PARAMETER CODE
     Fields fields = new Fields();
   ParameterField pfield1 = new ParameterField();

    Values vals1 = new Values();

    ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();

    pfield1.setName("theparam");

    pfield1.setReportName("");

    pfieldDV1.setValue("ALZOID");

    pfieldDV1.setDescription("The country is Spain.");

    vals1.add(pfieldDV1);

    pfield1.setCurrentValues(vals1);

    fields.add(pfield1);

   
    //Set the parameters
    exportControl.setParameterFields(fields);
    exportControl.setEnableParameterPrompt(true);
   
    //Set the Export Options
    ExportOptions exportOptions = new ExportOptions();

    exportOptions.setExportFormatType(ReportExportFormat.PDF);

    PDFExportFormatOptions pdfExpOpts = new PDFExportFormatOptions();
    exportOptions.setFormatOptions(pdfExpOpts);

    exportControl.setExportOptions(exportOptions);
    exportControl.setEnableLogonPrompt(true);
    exportControl.setExportAsAttachment(true);

    //exportControl.refresh();

    exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
} catch (Exception e) {
    out.print("EXXXXXXX:::: " + e.getMessage());
    StackTraceElement[] stack = e.getStackTrace();
    for(int k=0;k<stack.length;k++) {
        out.println("<br>"+stack[k].toString());
       
    }
   
}
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Does that code work without the parameters?

mlmcc
0
 

Author Comment

by:alzoid69
Comment Utility
It's strange.   The code worked on the new report without parameters.  So I added a parameter and it didn't work.  I removed the parameter from the report and I removed the code that sets the parameters and I am getting the logon error again.  

So the export code worked once.  When I added the parameter it stopped working, when I removed the parameter and the code for the parameter it still did not work.  I'm trying to get a basic report working again so I can post the 'working' code.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
I see some potential issues witht he posted code but I don't know the ASP methods so not sure if the issues are a problem.  Please post the working code when you get it.

mlmcc
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:alzoid69
Comment Utility
I have not got the code working yet.  What are some issues you see with the code?
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
It was your original code.  You seemed to be doing some things in the wrong order.  The last code you posted looks ok.

mlmcc
0
 
LVL 13

Expert Comment

by:EwaldL
Comment Utility
Try removing this line
exportControl.setEnableParameterPrompt(true);

If that doesn't help, then I'd focus on teh sample applications. Take the parameter one and try using it exactly as provided. IF this works you can compare it to your report/code
http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/JRC_SDK/jrc_java_dg_doc/doc/jrcsdk_java_dg/jrcsdk_java_howto_samples.zip
0
 

Author Comment

by:alzoid69
Comment Utility
The examples use code that is not avaiable in my libararies.  It sayd for Crystal Reports Release 2.  I dont have that, I have crystal 11.  DO I need to download / upgrade that application to get the latest JRC classes form Crystal?
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Release 2 is an upgrade to CR XI that is required for using Crystal with VS 2005.

You can get it from
http://www.businessobjects.com/products/reporting/crystalreports/compatibility_vs2005.asp

mlmcc
0
 

Author Comment

by:alzoid69
Comment Utility
I don't need VS 2k5 compatibility, hopefully this will also include the java classes that are used in the examples that were posted..  I will download it, its 700MEGS so it will take a while I will let you know if he new Java files are there.
0
 
LVL 13

Expert Comment

by:EwaldL
Comment Utility
cr xi release 2 also comes with an enhanced jrc. for instance it now includes a desktop java viewer. And by the look of it other stuff has been added too. So I'd definitely recommend getting this xi r2. The download is for free. Your current xi keycode will also work with the r2.
0
 

Author Comment

by:alzoid69
Comment Utility
I made a very basic report with only a text field that says Hello
I also wrote some JSP to Open the report.  

The Open method fails with an error code printed in he stack trace.

I am using absolute paths and the path is:

C:\Documents and Settings\alzoid.MYDOMAIN.001\My Documents\Netbeans\Q5AIMS_36\build\web\Reports\test.rpt

And that file exists at that path.

I am using netbeans as my development environment.

I updated to R2.   Here is my JSP Code:

<%@ page import="com.crystaldecisions.reports.sdk.*" %>

<%
    try{

 

       
        //GET THE SOURCE
     
        String report = application.getRealPath("") + "\\Reports\\test.rpt";
       
        ReportClientDocument reportClientDoc = new ReportClientDocument();
       
        reportClientDoc.open(report, 0);

        Object reportSource = reportClientDoc.getReportSource();
        //END GET THE SOURCE


         } catch (Exception e) {
        out.print("Message: [" + e.getMessage()+"]<br><br>");
        out.print("To String:  [" + e.toString()+"]<br><br>");
            out.print("Cause: [" + e.getCause()+"]<br><br>");
            out.print("Class: [" + e.getClass()+"]<br><br>");
        StackTraceElement[] stack = e.getStackTrace();
        out.print("Stack Trace:<br>");
        for(int k=0;k<stack.length;k++) {
            out.println("<br>"+stack[k].toString());

        }

    }
%>

Here is the error I am getting:

Message: [com.businessobjects.reports.sdk.JRCCommunicationAdapter]

To String: [com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: com.businessobjects.reports.sdk.JRCCommunicationAdapter---- Error code:-2147215357 Error code name:internal]

Cause: [null]

Class: [class com.crystaldecisions.sdk.occa.report.lib.ReportSDKException]

Stack Trace:

com.crystaldecisions.sdk.occa.report.lib.ReportSDKException.throwReportSDKException(Unknown Source)
com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Unknown Source)
com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(Unknown Source)
com.crystaldecisions.sdk.occa.report.application.ClientDocument.for(Unknown Source)
com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.for(Unknown Source)
com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)
com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
org.apache.jsp.ManagementReports.Report_jsp._jspService(Report_jsp.java:57)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)


I hope this helps.

Thank you,

Al
0
 

Author Comment

by:alzoid69
Comment Utility
I found out what was wrong.  I obtained the proper copy of the JRC Deployment Guide and found out that I was missing a few JAR files that were not mentioned in the docs I was looking at.  I added them and everything worked fine.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now