I have a JSR 168 portlet application which was originally developed for WebSphere Portal 6.0, then moved to WebSphere Portal 7.0 with the minimum of changes needed to make it work, and now I'm trying to move it to WebSphere Portal 8.5.
I've tested just one of the portlets so far on WP 8.5, using the WP 7.0 version of the app with no changes. It seems to be triggering the app's Error.jsp, which itself produces a NullPointerException in the server log.
The app's project facets include "JavaServer Faces 1.1" and "JavaServer Faces (IBM Enhanced) 7.0".
The portlet I'm testing has a JSP specified as a home page via this element in a portlet
element in the "portlet.xml" file in the app:
<init-param> <name>com.ibm.faces.portlet.page.view</name> <value>/Admin/AdministratorControlView.jsp</value> </init-param>
When I open a page containing this portlet in a browser, the expected content seems to render correctly, but links in the content don't do anything.
Every load of the page produces this stack trace in "SystemOut.log" on the server, which I've truncated somewhat:
[14/08/15 13:52:27:826 EST] 00000158 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service CWSRV0068E: An exception was thrown by one of the service methods of the servlet [/Error.jsp] in application [PA_TeamElite]. Exception created : [java.lang.NullPointerException at com.ibm.ws.portletcontainer.tags.DefineObjectsTag.doStartTag(DefineObjectsTag.java:62) at com.ibm._jsp._Error._jspService(_Error.java:105) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) ...
I assume some other error has triggered Error.jsp but, if so, the initial error doesn't appear in log files or in the browser.
What might cause the NullPointerException
in Error.jsp, and how can I fix it?
I suspect it's a configuration issue, but the full content of Error.jsp is below in case that's any help.MHFacesPortlet
used in Error.jsp is a custom class that extends com.ibm.faces.portlet.FacesPortlet
.
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false" isErrorPage="true"
import="com.devcompany.util.portlet.MHFacesPortlet"%>
<portlet:defineObjects />
<%javax.portlet.PortletURL url = renderResponse.createActionURL();
url.setParameter(MHFacesPortlet.PARAMETER_EXTENDED_ACTION,
MHFacesPortlet.ACTION_VIEW_MODE_RESET);
%>
<p>The following error has occurred. Click <a href="<%= url.toString()%>">here</a>
to go to the portlet home page.</p>
<%Throwable e = exception;
while (e != null)
{%>
<%=e.getMessage()%>
<br>
<br>
<%
e.printStackTrace();
e = e.getCause();
}%>
<portlet:defineObjects />
inside a JSP page that is not executed in portlet request flow. Are you sure yourError.jsp
is rendered as part of portlet and is not a standalone page? – Konstantin V. SalikhovError.jsp
works in older versions of WebSphere Portal and, when it renders, it does so in the same area of the page in which the portlet appears. – Scott Leis