and here is the code for these 3 JSPs: 1- Report_UI.jsp: -------------------- the first part of this jsp contains the fields (serach criteria) entered bty user, then i included the ReportsURL_RAS.jsp
// 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("CrystalReportViewer_RAS.jsp");
%>
3- CrystalReportViewer_RAS.jsp
<%@ page contentType="text/html"%> <%@ page pageEncoding="UTF-8"%> <%@ page import="com.crystaldecisions.sdk.occa.report.application.*, com.crystaldecisions.sdk.occa.report.data.*, com.crystaldecisions.sdk.occa.report.lib.*, com.crystaldecisions.report.web.viewer.*" %> <% /*===================================================================== INSTANTIATE THE VIEWER AND DISPLAY THE REPORT THROUGH 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 */ ReportClientDocument clientDoc = (ReportClientDocument)session.getAttribute("oClientDoc");
// Create a Viewer object CrystalReportViewer viewer = new CrystalReportViewer(); // Set the name for the viewer viewer.setName("Crystal_Report_Viewer"); // Set the source for the viewer to the client documents report source viewer.setReportSource(clientDoc.getReportSource());
// Process the http request to view the report viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
// Release the memory used by the report clientDoc.close();
%>
The Report is working OK, but if i click any button from the viewer bar sometimes it works and many times it gives the following exception:
Error page exception
Original Exception: Error Message: Error Code: 500 Target Servlet: /CrystalReportViewer_RAS.jsp Error Stack: java.lang.NullPointerException at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.d(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.getReportSource(Unknown Source) at com.ibm._jsp._CrystalReportViewer_5F_RAS._jspService(_CrystalReportViewer_5F_RAS.java:89) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1096) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:570) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
i know that the problem is that the oClientDoc session variable is read as Null which caused this exception.
the question now.. HOW COULD I PREVENT THIS EXCEPTION FROM APPEARING??????????????
I NEED YOU HELP, AND SORRY FOR THIS VERY LONG POST BUT I WANTED TO MAKE THE PROBLEM VERY CLEAR.
I'm using Unmanaged RAS method and i already create physical folder and put all my reports in it.
reports are appearing well and everything is OK, but sometimes when i click Print,refresh or export button in the Crystal Reports Viewer bar it give me NullPoiinterException at these classes:
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.d(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.getReportSource(Unknown Source)
which means that the Session variable of ReportClientDocument is read as Null in the CrystalReportViewer.jsp
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum