Reputation: 249
I am getting this IllegalStateException when trying to make a http (get or post) call for some data to my server. I am building this application that consumes other application´s methods. Name app1 for the client, app2 for the server. app2 has spring security core, spring security rest plugins. When I do the api/login, the token is rendered back to app1. Is ok to asume that the plugin handles the session already? Or should I handle it myself? Documentation is quite difficult to understand for me but I believe that is not clear. I am using the following versions of plugins
compile ':spring-security-core:2.0-RC3'
compile ':spring-security-ldap:2.0.0'
compile ':spring-security-rest:1.4.0', {
excludes: 'spring-security-core'
}
compile ':cors:1.1.6'
I will paste error for one get call, this error is thrown for every call I do in my app1. Tell me if you need something else to help you to figure out my problem.
Error |
2018-12-07 10:53:54,921 [http-bio-8080-exec-2] ERROR errors.GrailsExceptionResol
ver - IllegalStateException occurred when processing request: [GET] /TERA/repor
te/getInstancias
Cannot create a session after the response has been committed. Stacktrace follow
s:
Message: Cannot create a session after the response has been committed
Line | Method
->> 18 | doCall in SecurityFilters$_closure1_closure2_closure3
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 99 | processFilterChain in com.odobo.grails.plugin.springsecurity.rest.Res
tTokenValidationFilter
| 66 | doFilter . . . . . in ''
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsA
nonymousAuthenticationFilter
| 108 | doFilter . . . . . in com.odobo.grails.plugin.springsecurity.rest.Res
tAuthenticationFilter
| 62 | doFilter in grails.plugin.springsecurity.web.authentication
.logout.MutableLogoutFilter
| 63 | doFilter . . . . . in com.odobo.grails.plugin.springsecurity.rest.Res
tLogoutFilter
| 59 | doFilter in grails.plugin.springsecurity.web.SecurityReques
tHolderFilter
| 82 | doFilter . . . . . in com.brandseye.cors.CorsFilter
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
Thanks in advance!
Upvotes: 0
Views: 92
Reputation: 249
I have found that the scope of the service may cause this error, my scope is prototype and that is what is causing my error. I have changed it to session and it worked fine! The problem was that some jobs that had to run did not. So i set back the scope to prototype.
Upvotes: 0