Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Java Reporting Component Help

Posted on 2006-11-17
21
2,550 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
ID: 17969046
What versiion of Crystal?

Does the report have a subreport?

mlmcc
0
 

Author Comment

by:alzoid69
ID: 17978649
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
ID: 17979784
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:alzoid69
ID: 17981232
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
ID: 17981297
I removed the subreports from the main report and I still get the Logon Failed error
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 17981444
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
ID: 17986437
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
ID: 17987099
Does that code work without the parameters?

mlmcc
0
 

Author Comment

by:alzoid69
ID: 17987218
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
ID: 17987787
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
 

Author Comment

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

Expert Comment

by:mlmcc
ID: 17998005
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
ID: 17999927
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
ID: 18008499
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
ID: 18008555
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
ID: 18008860
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
ID: 18015599
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
ID: 18093405
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
ID: 18096303
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
ID: 18260568
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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