on 04-28-2012 7:58 PM
Hello,
I'm trying to do a maximo crystal Integration and when I run the report I'm getting
this error:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.runBoCrystalReport_jsp._jspService(runBoCrystalReport_jsp.java:492)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.24
Could you please let me know how to fix this error.
Thank you!
Martin
My advice is for Crystal Server 3.1 using Maximo 7.5.0.8 without SSL enabled on the Crystal Server.
You are getting this error because the JSP file is posting values to Crystal Reports where one of them is called mroDBType. mroDBType is expecting one of three values: ORACLE, SQLSERVER, or DB2 (the three databases supported by Maximo). The issue is because the parameter that Maximo is posting to Crystal (via /maximo/webclient/common/openreport.jsp) does not include mroDBType, or it is called something else.
In Maximo 7.5 and on, you would need to add a System Property called mxe.report.custom.mroDBType and give it a value of ORACLE, SQLSERVER, or DB2. When openreport.jsp passes the parameter to Crystal Reports, the parameter will be called custommroDBType.
This means, your runBoCrystalReport.jsp will need to have some code changes.
String dbType = request.getParameter("mroDBType");
will need to be changed to:
String dbType = request.getParameter("custommroDBType");
The code should look like this:
// Report server properties
String cmsName = request.getParameter("customboCmsName");
String rptServerUser = request.getParameter("customboEnterpriseLogon");
String rptServerPwd = request.getParameter("customrptServerLogonPass");
// Database properties
String dbUser = request.getParameter("ParmUserName");
String dbPwd = request.getParameter("ParmPassword");
String connectString = request.getParameter("customboConnectString");
String dbName = request.getParameter("customboDbName");
String dbType = request.getParameter("custommroDBType");
// Report properties
String rootFolder = request.getParameter("customboRootFolder");
String reportFolder = request.getParameter("reportFolder");
String reportName = request.getParameter("reportFile");
// Parameter values
String schema = request.getParameter("schema");
String where = request.getParameter("where");
String mroLangCode = request.getParameter("custommroLangCode");
String localeStr = request.getParameter("locale");
String debug = request.getParameter("customboDebugEnabled");
Any parameter you see with the word custom in front, will need a custom System Property in Maximo with the correct value.
Property Name | Description | Current Value |
mxe.report.custom.boCmsName | mxe.report.custom.boCmsName | crystalserver:6400 |
mxe.report.custom.boConnectString | mxe.report.custom.boConnectString | ODBC DSN name |
mxe.report.custom.boDbName | mxe.report.custom.boDbName | databasename |
mxe.report.custom.boDebugEnabled | mxe.report.custom.boDebugEnabled | false |
mxe.report.custom.boEnterpriseLogon | mxe.report.custom.boEnterpriseLogon | crystaluser |
mxe.report.custom.boEnterprisePwd | mxe.report.custom.boEnterprisePwd | |
mxe.report.custom.boRootFolder | mxe.report.custom.boRootFolder | rpt |
mxe.report.custom.mroDBType | mxe.report.custom.mroDBType | ORACLE |
mxe.report.custom.mroLangCode | mxe.report.custom.mroLangCode | EN |
mxe.report.custom.rptServerLogonPass | Password used for logging on to external report server | crystalpass |
mxe.report.custom.serverURL | URL of the custom reporting application | http://crystalserver/bocrystal/runBoCrystalReport.jsp |
Your InteractiveViewer.jsp may also need to be changed to reflect new CrystalReportViewer name.
// Create an Interactive Viewer
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setName("CrystalReportViewer");
//viewer.setOwnForm(true);
viewer.setOwnPage(true);
viewer.setPrintMode(CrPrintMode.PDF);
// Enable advanced search wizard
viewer.setEnableBooleanSearch(true);
Finally, your WEB-INF/web.xml will need to changed to point to the correct crystalreportsviewers. In the past, it may had a suffix of 115 or 12, but it seems going forward from Crystal Server 13.1, they are just using crystalreportviewers.
<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>crystalreportviewers</param-value>
</context-param>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sounds like someone is trying to integrate Maximo 7.5 with Crystal Reports using the old Crystal URL which was http://crystalserver:8080/bocrystal
I get the same error as your original post.
My current thought is to review the same file, runBoCrystalReport.jsp, and pull all the parameters the file wants. See which parameters are passed by Maximo 7.5 (via customreport.jsp demo file). Then in System Properties, add custom parameters that are not included and see if that helps or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not familiar with maximo crystal Integration, but the error you are getting is a null pointer exception with no detail about where it is being thrown. You will need to troubleshoot this further yourself to figure out what object is null.
The error mentions that you can get a full stack trace in the logs for Tomcat, might be a good place to start.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
I made a change to the runBoCrystalReport.jsp and now I'm getting this error. Could you please check it and see what needs to be done to fix it.
Thanks!
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /runBoCrystalReport.jsp at line 73
70: }
71:
72: // Validate database type
73: if ((!dbType.equalsIgnoreCase("ORACLE") && !dbType.equalsIgnoreCase("SQLSERVER")
74: && !dbType.equalsIgnoreCase("DB2")) || dbType == null)
75: {
76: String msg = messages.getString("Err_InvalidDBType") + ": " + dbType;
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.runBoCrystalReport_jsp._jspService(runBoCrystalReport_jsp.java:492)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
*****************************************************************************************
Here is the runBoCrystalReport.jsp
*****************************************************************************************
<%@ page language="java" %>
<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
<%@ page import="com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr" %>
<%@ page import="javax.servlet.http.Cookie" %>
<%@ page import="psdi.util.CipherPlusBase64" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="utilities.jsp" %>
<%
// Report server properties
String cmsName = request.getParameter("boCmsName");
String rptServerUser = request.getParameter("boEnterpriseLogon");
String rptServerPwd = request.getParameter("boEnterprisePwd");
// Database properties
String dbUser = request.getParameter("ParmUserName");
String dbPwd = request.getParameter("ParmPassword");
String connectString = request.getParameter("boConnectString");
String dbName = request.getParameter("boDbName");
String dbType = request.getParameter("mroDBType");
// Report properties
String rootFolder = request.getParameter("boRootFolder");
String reportFolder = request.getParameter("reportFolder");
String reportName = request.getParameter("reportFile");
// Parameter values
String schema = request.getParameter("schema");
String where = request.getParameter("where");
String mroLangCode = request.getParameter("mroLangCode");
String localeStr = request.getParameter("locale");
String debug = request.getParameter("boDebugEnabled");
// Initialize session variables
session.removeAttribute("rptClientDoc");
session.removeAttribute("errorMsg");
session.setAttribute("reportName", reportName);
if (debug.equalsIgnoreCase("true")) System.out.println("--------------------------------------------------");
Locale locale = getLocale(localeStr, "-_");
session.setAttribute("locale", locale);
// Load error messages for this locale.
ResourceBundle messages = (ResourceBundle)session.getAttribute("messages");
if (messages == null)
{
messages = ResourceBundle.getBundle("messages", locale);
session.setAttribute("messages", messages);
}
// Decrypt passwords
try
{
dbPwd = CipherPlusBase64.decrypt(dbPwd, true);
if (!rptServerPwd.equals(""))
{
rptServerPwd = CipherPlusBase64.decrypt(rptServerPwd, true);
}
}
catch (Exception e)
{
System.out.println(messages.getString("Err_Decrypt") + ": " + e.getMessage());
throw new ErrorPageException("");
}
// Validate database type
if ((!dbType.equalsIgnoreCase("ORACLE") && !dbType.equalsIgnoreCase("SQLSERVER")
&& !dbType.equalsIgnoreCase("DB2")) || dbType == null)
{
String msg = messages.getString("Err_InvalidDBType") + ": " + dbType;
System.out.println(msg);
throw new ErrorPageException(msg);
}
// Create list of parameters, including names, values, and if they are required
Vector params = new Vector(4);
params.addElement(new ReportParameter("{?where}", where, true));
params.addElement(new ReportParameter("{?mroLangCode}", mroLangCode, false));
params.addElement(new ReportParameter("{?localeStr}", localeStr, false));
params.addElement(new ReportParameter("{?schema}", schema, dbType.equalsIgnoreCase("ORACLE")));
%>
<html>
<head>
<title>MXES-Business Objects Integration</title>
</head>
<body>
<%
// Create folder hierarchy to use in querying CMS
String[] folders = {rootFolder, reportFolder, "reports"};
// Connect to Enterprise and retrieve ReportClientDocument of requested report
boolean getNewEnterpriseSession = true;
IInfoObject report = null;
ReportClientDocument clientDoc = null;
IInfoStore infoStore = (IInfoStore)session.getAttribute("infoStore");
IReportAppFactory rptAppFactory = (IReportAppFactory)session.getAttribute("rptAppFactory");
try
{
// If available, use cached IInfoStore and IReportAppFactory to open report.
if (infoStore != null && rptAppFactory != null)
{
String msg = null;
boolean redirect = false;
try
{
report = getReportFromStore(reportName, folders, infoStore, messages);
if (debug.equalsIgnoreCase("true")) System.out.println("found report in infoStore");
clientDoc = rptAppFactory.openDocument(report, 0, locale);
if (debug.equalsIgnoreCase("true")) System.out.println("opened report");
getNewEnterpriseSession = false;
if (debug.equalsIgnoreCase("true")) System.out.println("used cached infoStore and rptAppFactory to get clientDoc");
}
catch (SDKException e)
{
// Move on, try again with fresh infoStore & rptAppFactory
}
catch (ErrorPageException e)
{
throw new ErrorPageException(e.getMessage());
}
}
if (getNewEnterpriseSession == true)
// Log in to get Enterprise Session
{
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
IEnterpriseSession enterpriseSession = null;
boolean logonTokenFailed = true;
// Check if a login token exists; if so attempt to log in using it
String logonToken = getToken(request);
if (logonToken != null && !logonToken.equals(""))
{
try
{
enterpriseSession = sessionMgr.logonWithToken(logonToken);
// Add IEnterpriseSession to session; listener will log off when session times out
session.setAttribute("entSession", enterpriseSession);
if (debug.equalsIgnoreCase("true")) System.out.println("used token to create enterpriseSession");
logonTokenFailed = false;
}
catch (SDKException e)
{
// Move on; try logging on without token
if (debug.equalsIgnoreCase("true")) System.out.println("Unable to log on with token: " + e.getMessage());
}
}
// Logon token did not exist or logon attempt with token failed.
if (logonTokenFailed == true)
{
try
{
enterpriseSession = (IEnterpriseSession)sessionMgr.logon(rptServerUser, rptServerPwd, cmsName, "secEnterprise");
// Add IEnterpriseSession to session; listener will log off when session times out
session.setAttribute("entSession", enterpriseSession);
if (debug.equalsIgnoreCase("true")) System.out.println("used logon method to create enterpriseSession");
}
catch (SDKException e)
{
// This was final chance to log in; send to error page
System.out.println(messages.getString("Err_Header") + " " + reportName + ": " + e.getMessage(locale));
throw new ErrorPageException(e.getMessage(locale));
}
try
{
// Retrieve the logon token manager.
ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();
// Retrieve a logon token and store it as a cookie; give minutes active, number of logons allowed
Cookie cookie = new Cookie("LogonToken", logonTokenMgr.createLogonToken("", 480, -1));
response.addCookie(cookie);
if (debug.equalsIgnoreCase("true")) System.out.println("added new logon token to cookie");
}
catch (SDKException e)
{
if (debug.equalsIgnoreCase("true")) System.out.println("Could not create optional logon token cookie.");
// Move on; logon token isn't required
}
}
if (report == null)
{
try
{
infoStore = (IInfoStore)enterpriseSession.getService("", "InfoStore");
session.setAttribute("infoStore", infoStore);
if (debug.equalsIgnoreCase("true")) System.out.println("created new infoStore");
report = getReportFromStore(reportName, folders, infoStore, messages);
if (debug.equalsIgnoreCase("true")) System.out.println("retrieved report from infoStore");
}
catch (SDKException e)
{
// This was final chance to get report; send to error page
System.out.println(messages.getString("Err_Header") + " " + reportName + ": " + e.getMessage(locale));
throw new ErrorPageException(e.getMessage(locale));
}
catch (ErrorPageException e)
{
throw new ErrorPageException(e.getMessage());
}
}
try
{
rptAppFactory = (IReportAppFactory)enterpriseSession.getService("", "RASReportService");
session.setAttribute("rptAppFactory", rptAppFactory);
if (debug.equalsIgnoreCase("true")) System.out.println("created new rptAppFactory");
clientDoc = rptAppFactory.openDocument(report, 0, locale);
if (debug.equalsIgnoreCase("true")) System.out.println("opened report");
}
catch (SDKException e)
{
System.out.println(messages.getString("Err_Header") + " " + reportName + ": " + e.getMessage(locale));
throw new ErrorPageException(e.getMessage(locale));
}
}
if (clientDoc == null)
{
throw new ErrorPageException("");
}
try
{
updateConnection(clientDoc, connectString, dbType, dbName, dbUser, dbPwd, debug, messages, reportName);
setParameters(clientDoc, params, locale, messages, reportName);
}
catch (ErrorPageException e)
{
throw new ErrorPageException(e.getMessage());
}
// Store the ReportClientDocument in session to be retrieved by the Viewer jsp page
session.setAttribute("rptClientDoc", clientDoc);
System.out.println("sending to viewer");
// Redirect to the Viewer page to keep processing seperate
response.sendRedirect("interactiveViewer.jsp");
}
catch (ErrorPageException epe)
{
// Throw this error whenever we hit a dead end.
session.setAttribute("errorMsg", epe.getMessage());
response.sendRedirect("error.jsp");
}
catch (Exception ex)
{
System.out.println(messages.getString("Err_Header") + " " + reportName);
ex.printStackTrace();
session.setAttribute("errorMsg", "");
response.sendRedirect("error.jsp");
}
%>
</body>
</html>
***************************************************************************************************
You are still getting a java.lang.NullPointerException. You are trying to do something with a null object. The error tells you that it is on line 73.
73: if ((!dbType.equalsIgnoreCase("ORACLE") && !dbType.equalsIgnoreCase("SQLSERVER")
74: && !dbType.equalsIgnoreCase("DB2")) || dbType == null)
maybe check to see if dbType is null before doing the rest of this if statement.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.