Here is the relevant part of the main reason:
Caused by: java.lang.NullPointerException at org.apache.catalina.connector.Request.parseParameters(Request.java:2599) at org.apache.catalina.connector.Request.getParameter(Request.java:1106) at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:355) at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:158) at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:158) at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1152) at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:1140) at java.util.Collections$UnmodifiableMap.get(Collections.java:1282) at com.mounza.homepage.UserHomepageAction.update(UserHomepageAction.java:47) ...
This exception indicates that the HTTP request has expired / processed. I donβt have any sight in your code, but this exception, in turn, indicates that you get an instance of FacesContext or ExternalContext , or a map returned by ExternalContext#getRequestParameterMap() as a class variable managed by bean that lives in a wider scope than the scope of the request, for example:
@ManagedBean @ViewScoped // Or @SessionScoped or @ApplicationScoped public class UserHomepageAction { private Map<String, String> params; public UserHomepageAction() { params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); } public void update() { String value = params.get(name); // Fail!! // ... } }
You must never do this. The bean's lifetime spans multiple HTTP requests. The bean action method is called during a different HTTP request than the bean was created. Instead, you should get local thread / request variables in the local scope of the method:
public void update() { Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String value = params.get(name);
Unrelated to a specific problem: messing around with a query parameter card as if it were a smell. Have you looked at <f:viewParam> ? See Also. What can <f: metadata>, <f: viewParam> and <f: viewAction> for use? .
source share