java.lang.IllegalStateException: Cannot create a session after the response has been committed

Liferay Issues | Minhchau Dang | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [LPS-43358] Liferay Util methods may attempt to create a session after response is committed - Liferay Issues

    liferay.com | 1 year ago
    java.lang.IllegalStateException: Cannot create a session after the response has been committed
  2. 0

    Even after the response has been committed (for example, on a {{sendRedirect}}), some utility methods may be called. Some of these utility methods will call {{request.getSession()}}, resulting in an {{IllegalStateException}} if a session has not yet been created. {code:title=LanguageUtil.getLanguageId(HttpServletRequest)|borderStyle=solid} java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2886) at org.apache.catalina.connector.Request.getSession(Request.java:2316) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910) at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3294) at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3222) at com.liferay.portal.util.PortalUtil.getLocale(PortalUtil.java:928) at com.liferay.portal.language.LanguageImpl.getLanguageId(LanguageImpl.java:513) at com.liferay.portal.kernel.language.LanguageUtil.getLanguageId(LanguageUtil.java:220) {code} {code:title=SessionParamUtil.getBoolean(HttpServletRequest, HttpServletResponse, String)|borderStyle=solid} java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2886) at org.apache.catalina.connector.Request.getSession(Request.java:2316) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910) at com.liferay.portal.kernel.util.SessionParamUtil.getBoolean(SessionParamUtil.java:35) {code}

    Liferay Issues | 3 years ago | Minhchau Dang
    java.lang.IllegalStateException: Cannot create a session after the response has been committed
  3. 0

    Even after the response has been committed (for example, on a {{sendRedirect}}), some utility methods may be called. Some of these utility methods will call {{request.getSession()}}, resulting in an {{IllegalStateException}} if a session has not yet been created. {code:title=LanguageUtil.getLanguageId(HttpServletRequest)|borderStyle=solid} java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2886) at org.apache.catalina.connector.Request.getSession(Request.java:2316) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910) at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3294) at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3222) at com.liferay.portal.util.PortalUtil.getLocale(PortalUtil.java:928) at com.liferay.portal.language.LanguageImpl.getLanguageId(LanguageImpl.java:513) at com.liferay.portal.kernel.language.LanguageUtil.getLanguageId(LanguageUtil.java:220) {code} {code:title=SessionParamUtil.getBoolean(HttpServletRequest, HttpServletResponse, String)|borderStyle=solid} java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2886) at org.apache.catalina.connector.Request.getSession(Request.java:2316) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910) at com.liferay.portal.kernel.util.SessionParamUtil.getBoolean(SessionParamUtil.java:35) {code}

    Liferay Issues | 3 years ago | Minhchau Dang
    java.lang.IllegalStateException: Cannot create a session after the response has been committed
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Cannot create a session after the response has been committed

    at org.apache.catalina.connector.Request.doGetSession()
  2. Glassfish Core
    RequestFacade.getSession
    1. org.apache.catalina.connector.Request.doGetSession(Request.java:2886)
    2. org.apache.catalina.connector.Request.getSession(Request.java:2316)
    3. org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
    4. org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
    4 frames
  3. Liferay Portal Service
    PortalUtil.getLocale
    1. com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3294)
    2. com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3222)
    3. com.liferay.portal.util.PortalUtil.getLocale(PortalUtil.java:928)
    3 frames
  4. Liferay Portal Impl
    LanguageImpl.getLanguageId
    1. com.liferay.portal.language.LanguageImpl.getLanguageId(LanguageImpl.java:513)
    1 frame
  5. Liferay Portal Service
    LanguageUtil.getLanguageId
    1. com.liferay.portal.kernel.language.LanguageUtil.getLanguageId(LanguageUtil.java:220)
    1 frame