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

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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}
    via by Minhchau Dang,
  • 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}
    via by Minhchau Dang,
    • 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)

    Users with the same issue

    QrCeric
    QrCeric1 times, last one,
    Shadd518
    Shadd5181 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    3 more bugmates