Hello, I am using CE 10 Embedded and weblogic 8.1 SP2 to execute reports using JSP. Every time I attempt to execute sample reports for this version and edition of CE I receive following error (it states that it is failing on PreviewReport.jsp:61 whinch is the line that actually initialize the RAS):
Servlet failed with Exception
java.lang.NullPointerException
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.do()V(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize()V(Unknown Source)
at jsp_servlet._test.__previewreport._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponseV(PreviewReport.jsp:61)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponseV(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImplV(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponseV(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedActionLjava.lang.Object;(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedActionLjava.lang.O
bject;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImplV(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThreadV(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequestV(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:170)
at java.lang.Thread.startThreadFromVM(Ljava.lang.ThreadV(Unknown Source)
>
Following is the code used for jsp:
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*,
com.crystaldecisions.sdk.occa.report.data.*,
com.crystaldecisions.sdk.occa.report.lib.*"
%>
<html>
<head>
<title>Begin Here - Simple Preview Report</title>
</head>
<body>
<%
/*=================================================================
WORKING WITH THE REPORT APPLICATION SERVER AND JSP TO VIEW REPORTS
===================================================================
REQUIRED STEPS
- Create a new Report Application Session
- Create a Report Application Server (RAS) Service
- Set the RAS Server to be used for the service
- Initialize the RAS Service
- Create the report client document object
- Set the RAS Server to be used for the report client document
- Open the report, and set the open type to Read Only
INSTANTIATE THE REPORT VIEWER
- Create a Viewer object
- Set the source for the viewer to the client documents report source
- Process the http request to view the report
- Dispose of the viewer object
========================================================*/
// Helper function - Get physical path to the jsp page to open the report
String temp1 = (request.getRequestURI()).replace('/', '\\');
String path = request.getRealPath("/") + temp1.substring(8); // Get the physical path of the application dir
int lastIndex = path.lastIndexOf("\\"); // Give us index of last occurring '\' in string
path = path.substring(0, lastIndex) + "\\"; // Get substring beginning from first char to last index of '\'
//String reportPath = "D:\\bea\\user_projects\\domains\\mydomain\\upload\\eDemand\\test\\";
// Specify the report to be opened
String reportName ="SimplePreviewReport.rpt";
%>
<%
/* ALWAYS REQUIRED STEPS
- Create a new Report Application Session
- Create a Report Application Server (RAS) Service
- Set the RAS Server to be used for the service
- Initialize the RAS Service
- Create the report client document object
- Set the RAS Server to be used for the report client document
- Open the report, and set the open type to Read Only
*/
// Create a new Report Application Session
ReportAppSession ra = new ReportAppSession();
// Create a Report Application Server Service
ra.createService("com.crystaldecisions.sdk.occa.report.application.ReportClientDocument");
// Set the RAS Server to be used for the service
ra.setReportAppServer("127.0.0.1");
// Initialize RAS
ra.initialize();
// Create the report client document object
ReportClientDocument clientDoc = new ReportClientDocument();
// Set the RAS Server to be used for the Client Document
clientDoc.setReportAppServer(ra.getReportAppServer() );
// Open the report, and set the open type to Read Only
clientDoc.open(path + reportName, OpenReportOptions._openAsReadOnly);
%>
<%
/*=========================================================
INSTANTIATE THE REPORT VIEWER
=========================================================
Use one of the zero client DHTML Viewers to display the report
by redirecting to the corresponding JSP file.
- Crystal Reports Interactive Viewer = CrystalReportsInteractiveViewer.jsp
- Crystal Reports Viewer = CrystalReportsViewer.jsp
- Crystal Reports Parts Viewer = CrystalReportsPartsViewer.jsp
NOTE - To use the report parts viewer successfully you are required to
choose and name three objects in the report to Node0, Node1 and Node2.
You can access an object's name by using the Format Editor dialog box.
For more information on the Format Editor Dialog Box and setting objects
names, please refer to the Help Contents (Help Menu->Crystal Reports Help)
or by pressing F1 in the Crystal Reports Designer.
=========================================================*/
// Store the ReportClientDocument in session to be retrieved by the Viewer jsp page
session.setAttribute("oClientDoc", clientDoc);
// Redirect to the Viewer page to keep processing seperate
response.sendRedirect("CrystalReportsInteractiveViewer.jsp");
%>
</body>
</html>
Servlet failed with Exception
java.lang.NullPointerException
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.do()V(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize()V(Unknown Source)
at jsp_servlet._test.__previewreport._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponseV(PreviewReport.jsp:61)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponseV(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImplV(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponseV(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedActionLjava.lang.Object;(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedActionLjava.lang.O
bject;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImplV(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThreadV(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequestV(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:170)
at java.lang.Thread.startThreadFromVM(Ljava.lang.ThreadV(Unknown Source)
>
Following is the code used for jsp:
<%@ page import="com.crystaldecisions.sdk.occa.report.application.*,
com.crystaldecisions.sdk.occa.report.data.*,
com.crystaldecisions.sdk.occa.report.lib.*"
%>
<html>
<head>
<title>Begin Here - Simple Preview Report</title>
</head>
<body>
<%
/*=================================================================
WORKING WITH THE REPORT APPLICATION SERVER AND JSP TO VIEW REPORTS
===================================================================
REQUIRED STEPS
- Create a new Report Application Session
- Create a Report Application Server (RAS) Service
- Set the RAS Server to be used for the service
- Initialize the RAS Service
- Create the report client document object
- Set the RAS Server to be used for the report client document
- Open the report, and set the open type to Read Only
INSTANTIATE THE REPORT VIEWER
- Create a Viewer object
- Set the source for the viewer to the client documents report source
- Process the http request to view the report
- Dispose of the viewer object
========================================================*/
// Helper function - Get physical path to the jsp page to open the report
String temp1 = (request.getRequestURI()).replace('/', '\\');
String path = request.getRealPath("/") + temp1.substring(8); // Get the physical path of the application dir
int lastIndex = path.lastIndexOf("\\"); // Give us index of last occurring '\' in string
path = path.substring(0, lastIndex) + "\\"; // Get substring beginning from first char to last index of '\'
//String reportPath = "D:\\bea\\user_projects\\domains\\mydomain\\upload\\eDemand\\test\\";
// Specify the report to be opened
String reportName ="SimplePreviewReport.rpt";
%>
<%
/* ALWAYS REQUIRED STEPS
- Create a new Report Application Session
- Create a Report Application Server (RAS) Service
- Set the RAS Server to be used for the service
- Initialize the RAS Service
- Create the report client document object
- Set the RAS Server to be used for the report client document
- Open the report, and set the open type to Read Only
*/
// Create a new Report Application Session
ReportAppSession ra = new ReportAppSession();
// Create a Report Application Server Service
ra.createService("com.crystaldecisions.sdk.occa.report.application.ReportClientDocument");
// Set the RAS Server to be used for the service
ra.setReportAppServer("127.0.0.1");
// Initialize RAS
ra.initialize();
// Create the report client document object
ReportClientDocument clientDoc = new ReportClientDocument();
// Set the RAS Server to be used for the Client Document
clientDoc.setReportAppServer(ra.getReportAppServer() );
// Open the report, and set the open type to Read Only
clientDoc.open(path + reportName, OpenReportOptions._openAsReadOnly);
%>
<%
/*=========================================================
INSTANTIATE THE REPORT VIEWER
=========================================================
Use one of the zero client DHTML Viewers to display the report
by redirecting to the corresponding JSP file.
- Crystal Reports Interactive Viewer = CrystalReportsInteractiveViewer.jsp
- Crystal Reports Viewer = CrystalReportsViewer.jsp
- Crystal Reports Parts Viewer = CrystalReportsPartsViewer.jsp
NOTE - To use the report parts viewer successfully you are required to
choose and name three objects in the report to Node0, Node1 and Node2.
You can access an object's name by using the Format Editor dialog box.
For more information on the Format Editor Dialog Box and setting objects
names, please refer to the Help Contents (Help Menu->Crystal Reports Help)
or by pressing F1 in the Crystal Reports Designer.
=========================================================*/
// Store the ReportClientDocument in session to be retrieved by the Viewer jsp page
session.setAttribute("oClientDoc", clientDoc);
// Redirect to the Viewer page to keep processing seperate
response.sendRedirect("CrystalReportsInteractiveViewer.jsp");
%>
</body>
</html>