Hi ,
I was evaluating app servers for web applications and i was trying
to use reports in web applications.
I am using Crystal Reports 9.0 RAS(Report Application Server)
with IBM Websphere .I tried to get a pdf file from JSP using Report
SDK provided by Crystal Reports 9.0 RAS .The code is giving me
servlet language exception at runtime but it is running on Weblogic
without any error.Something related to strictservletlifecycle.Although
code is going to RAS but at a point it is giving me the problem.
Is it a server related problem ????
I am pasting the code and the Exception below..Plz let
me know if it is server dependent.
Code is pasted below
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page session="true"%>
<%@ page import="javax.servlet.jsp.*"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.net.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*" %>
<%@ page import="com.crystaldecisions.report.web.viewer.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*" %>
<!--Code Starts here ........... -->
<%
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$"
String reportName=(String)request.getAttribute("ReportName"
String requestNumber=(String)request.getAttribute("RequestNumber"
String requestNumber="RPT_112";
System.out.println("********************"
ParameterField newParameter = new ParameterField();
ParameterField newField = null;
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@"
ParameterFieldDiscreteValue newValue = null;
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^"
try{
ReportClientDocument rptClientDoc = new ReportClientDocument();
//System.out.println("11111111111111111111111111"
/* Change DCWKS0241AB to the name of Machine where RAS is installed for ex like DCWKS0237 */
rptClientDoc.setReportAppServer("DCWKS0241AB"
System.out.println("22222222222222222222222222"
/* Change this E:\\Crystal\\Reports\\ to the path where your reports are kept */
String reportPath="E:\\RAS\\Reports\\Percentages.rpt";
rptClientDoc.open (reportPath, 0);
rptClientDoc.getDatabaseController().logon("bbva","bbva"
System.out.println("After Creating the Client Document on the Report"
/* folowing Code remove any default value to the report and append the request number in the input parameter*/
newField = (ParameterField)rptClientDoc.getDataDefinition().getParameterFields().getField(0);
newField.copyTo(newParameter,true);
newParameter.getCurrentValues().removeAllElements();
newValue=new ParameterFieldDiscreteValue();
newValue.setValue(requestNumber);
newParameter.getCurrentValues().add(newValue);
/* Just for Testing Purpose
Values v=newParameter.getCurrentValues();
IValue iv=v.getValue(0);
System.out.println("---> "+iv.computeText());
*/
rptClientDoc.getDataDefController().getParameterFieldController().modify(newField, newParameter);
/* Specifying the Format */
PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
//Create the ExportOptions object, set the PDF export options, and set the format type to PDF.
ExportOptions exOpts = new ExportOptions();
exOpts.setFormatOptions(PDFExpOpts);
exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._PDF));
System.out.println("After Setting the format"
System.out.println("Before getting source"
//Create the ReportExportControl object and set the report source to the report that will be exported to PDF.
ReportExportControl expViewer = new ReportExportControl();
System.out.println("Before getting source"
expViewer.setReportSource (rptClientDoc.getReportSource());
System.out.println("3"
//Set the export options to the ReportExportControl object.
expViewer.setExportOptions(exOpts);
System.out.println("After Setting the Export Options to the ReportExportControl object."
//Set the exported report to display in the browser.
//The setExportAsAttachment method is set to false by default. If it is set to true the user will be presented with the File Download dialog box to save the exported report to disk.
expViewer.setExportAsAttachment(false);
//Export and view the report.
expViewer.processHttpRequest(request, response, (getServletConfig()).getServletContext(),null);
System.out.println("After Exporting and viewing the report back in the Browser."
//Destroy the control.
expViewer.dispose();
}
catch (Exception e)
{
out.write("Error: Open" + e.toString() + "\n"
}
%>
Exception
[11/21/02 15:27:49:465 GMT+05:30] 2c89cb91 SystemOut U $$$$$$$$$$$$$$$$$$$$$$$$
[11/21/02 15:27:51:325 GMT+05:30] 2c89cb91 SystemOut U 22222222222222222222222222
[11/21/02 15:27:55:669 GMT+05:30] 2c89cb91 SystemOut U After Creating the Client Document on the Report
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 SystemOut U After Setting the format
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 SystemOut U Before getting source
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 WebGroup X Servlet Error: javax/servlet/ServletRequest: java.lang.Exception: javax/servlet/ServletRequest
at jsp._testExport_jsp_2._jspService(_testExport_jsp_2.java:286)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:312)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:487)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:167)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:678)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:331)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:117)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:239)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:151)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:137)
I was evaluating app servers for web applications and i was trying
to use reports in web applications.
I am using Crystal Reports 9.0 RAS(Report Application Server)
with IBM Websphere .I tried to get a pdf file from JSP using Report
SDK provided by Crystal Reports 9.0 RAS .The code is giving me
servlet language exception at runtime but it is running on Weblogic
without any error.Something related to strictservletlifecycle.Although
code is going to RAS but at a point it is giving me the problem.
Is it a server related problem ????
I am pasting the code and the Exception below..Plz let
me know if it is server dependent.
Code is pasted below
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page session="true"%>
<%@ page import="javax.servlet.jsp.*"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.net.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*" %>
<%@ page import="com.crystaldecisions.report.web.viewer.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.definition.*" %>
<!--Code Starts here ........... -->
<%
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$"
String reportName=(String)request.getAttribute("ReportName"
String requestNumber=(String)request.getAttribute("RequestNumber"
String requestNumber="RPT_112";
System.out.println("********************"
ParameterField newParameter = new ParameterField();
ParameterField newField = null;
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@"
ParameterFieldDiscreteValue newValue = null;
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^"
try{
ReportClientDocument rptClientDoc = new ReportClientDocument();
//System.out.println("11111111111111111111111111"
/* Change DCWKS0241AB to the name of Machine where RAS is installed for ex like DCWKS0237 */
rptClientDoc.setReportAppServer("DCWKS0241AB"
System.out.println("22222222222222222222222222"
/* Change this E:\\Crystal\\Reports\\ to the path where your reports are kept */
String reportPath="E:\\RAS\\Reports\\Percentages.rpt";
rptClientDoc.open (reportPath, 0);
rptClientDoc.getDatabaseController().logon("bbva","bbva"
System.out.println("After Creating the Client Document on the Report"
/* folowing Code remove any default value to the report and append the request number in the input parameter*/
newField = (ParameterField)rptClientDoc.getDataDefinition().getParameterFields().getField(0);
newField.copyTo(newParameter,true);
newParameter.getCurrentValues().removeAllElements();
newValue=new ParameterFieldDiscreteValue();
newValue.setValue(requestNumber);
newParameter.getCurrentValues().add(newValue);
/* Just for Testing Purpose
Values v=newParameter.getCurrentValues();
IValue iv=v.getValue(0);
System.out.println("---> "+iv.computeText());
*/
rptClientDoc.getDataDefController().getParameterFieldController().modify(newField, newParameter);
/* Specifying the Format */
PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
//Create the ExportOptions object, set the PDF export options, and set the format type to PDF.
ExportOptions exOpts = new ExportOptions();
exOpts.setFormatOptions(PDFExpOpts);
exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._PDF));
System.out.println("After Setting the format"
System.out.println("Before getting source"
//Create the ReportExportControl object and set the report source to the report that will be exported to PDF.
ReportExportControl expViewer = new ReportExportControl();
System.out.println("Before getting source"
expViewer.setReportSource (rptClientDoc.getReportSource());
System.out.println("3"
//Set the export options to the ReportExportControl object.
expViewer.setExportOptions(exOpts);
System.out.println("After Setting the Export Options to the ReportExportControl object."
//Set the exported report to display in the browser.
//The setExportAsAttachment method is set to false by default. If it is set to true the user will be presented with the File Download dialog box to save the exported report to disk.
expViewer.setExportAsAttachment(false);
//Export and view the report.
expViewer.processHttpRequest(request, response, (getServletConfig()).getServletContext(),null);
System.out.println("After Exporting and viewing the report back in the Browser."
//Destroy the control.
expViewer.dispose();
}
catch (Exception e)
{
out.write("Error: Open" + e.toString() + "\n"
}
%>
Exception
[11/21/02 15:27:49:465 GMT+05:30] 2c89cb91 SystemOut U $$$$$$$$$$$$$$$$$$$$$$$$
[11/21/02 15:27:51:325 GMT+05:30] 2c89cb91 SystemOut U 22222222222222222222222222
[11/21/02 15:27:55:669 GMT+05:30] 2c89cb91 SystemOut U After Creating the Client Document on the Report
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 SystemOut U After Setting the format
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 SystemOut U Before getting source
[11/21/02 15:27:55:715 GMT+05:30] 2c89cb91 WebGroup X Servlet Error: javax/servlet/ServletRequest: java.lang.Exception: javax/servlet/ServletRequest
at jsp._testExport_jsp_2._jspService(_testExport_jsp_2.java:286)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:312)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:487)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:167)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:678)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:331)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:117)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:239)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:151)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:137)