jeetmp3 / spring-session

Apache License 2.0
18 stars 24 forks source link

Cannot create a session after the response has been committed #3

Closed psoares closed 9 years ago

psoares commented 9 years ago

I tried to install the plugin on my grails app that's under 2.5.0 and my app won't start. I'm using redis 3.0.3, and the plugin version 1.0.1.

Here is what I get at startup :

java.lang.IllegalStateException: Cannot create a session after the response has been committed
    at org.apache.catalina.connector.Request.doGetSession(Request.java:2934)
    at org.apache.catalina.connector.Request.getSession(Request.java:2310)
    at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
    at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:909)
    at grails.plugin.springsession.web.http.HttpSessionSynchronizer.doFilterInternal(HttpSessionSynchronizer.java:20)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I also tried to use the plugin on an empty 2.5.0 project with no configuration alterations other than adding the plugin to BuildConfig.groovy, and got this :

++++++ Configuring Spring session
++++++ Finished Spring Session configuration
|Server running. Browse to http://localhost:8080/RedisSessionTest
| Error 2015-10-01 16:52:38,810 [http-bio-8080-exec-10] ERROR [/RedisSessionTest].[gsp]  - Servlet.service() for servlet [gsp] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,890 [http-bio-8080-exec-7] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,890 [http-bio-8080-exec-6] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,863 [http-bio-8080-exec-9] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,863 [http-bio-8080-exec-8] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,951 [http-bio-8080-exec-5] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,953 [http-bio-8080-exec-2] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
| Error 2015-10-01 16:52:38,959 [http-bio-8080-exec-4] ERROR [/RedisSessionTest].[default]  - Servlet.service() for servlet [default] in context with path [/RedisSessionTest] threw exception
Message: Cannot create a session after the response has been committed
    Line | Method
->>   20 | doFilterInternal in grails.plugin.springsession.web.http.HttpSessionSynchronizer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1142 | runWorker        in java.util.concurrent.ThreadPoolExecutor
|    617 | run . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run              in java.lang.Thread
jeetmp3 commented 9 years ago

Hi @psoares this issue is fixed in 1.0 version. Check with the latest plugin version.