[opencms-dev] OpenCms 8 Login / Logout

Sandrine Prousteau s.prousteau at eurelis.com
Tue Sep 25 10:57:19 CEST 2012


Hi!
I'm on OpenCms 8.0.4, and I try to have a jsp included at the top of my page to manage login/logout for my site's users before displaying the content of the page.

I have this error when I do :

<jsp:useBean id="bean" class="org.opencms.jsp.CmsJspLoginBean"><% bean.init(pageContext, request, response); %></jsp:useBean>
if(!bean.isLoggedIn()){
  ...
}else{
  try {
    String paramLogout = org.opencms.util.CmsRequestUtil.getNotEmptyParameter(request, org.opencms.workplace.CmsLogin.PARAM_ACTION_LOGOUT); 
    if (Boolean.valueOf(paramLogout).booleanValue()){
      bean.logout();
      LOG.debug("LOGIN-LOGOUT : bean.logout();");
    }
  } catch (Exception e) {
  LOG.error("LOGIN-LOGOUT : "+e);
  }
}

25 Sep 2012 11:01:43,349 ERROR [opencms.jsp.CmsJspTagContainer: 359] Cannot create a session after the response has been committed
java.lang.IllegalStateException: Cannot create a session after the response has been committed
	at org.apache.catalina.connector.Request.doGetSession(Request.java:2734)
	at org.apache.catalina.connector.Request.getSession(Request.java:2244)
	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)
	at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229)
	at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:572)
	at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:517)
	at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238)
	at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238)
	at org.opencms.jsp.CmsJspTagContainer.getSessionCache(CmsJspTagContainer.java:744)
	at org.opencms.jsp.CmsJspTagContainer.renderContainerElement(CmsJspTagContainer.java:847)
	at org.opencms.jsp.CmsJspTagContainer.doStartTag(CmsJspTagContainer.java:356)

How can I avoid this?
Thank in advance.
Sandrine.




More information about the opencms-dev mailing list