I've had my app with shiro working great for a while now. But
yesterday I had a problem with my Eclipse workspace and I had to
re-import all my projects. Now I'm getting an IllegalStateException
(full stacktrace at bottom of message):
No ServletRequest found in ThreadContext. Make sure WebUtils.bind() is
being called. (typically called by ShiroFilter) This could also
happen when running integration tests that don't properly call
WebUtils.bind().
I'm not sure why it would just stop working. Perhaps I updated my
maven repo during the reconfiguring of my workspace and the version of
shiro got updated to the latest 1.0-incubating-SNAPSHOT. I'm
configuring shiro with SpringShiroFilter in web.xml and here is a
snippet from my spring config:
<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
<bean id="lifecycleBeanPostProcessor"
class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<bean id="securityManager"
class="org.apache.shiro.web.DefaultWebSecurityManager">
<property name="realm" ref="sprtzRealm"/>
</bean>
<bean name="sprtzRealm" class="com.sprtz.security.SprtzRealm">
<property name="memberService" ref="memberService"/>
</bean>
Where and how am I supposed to call WebUtils.bind()?
Thanks,
Tauren
--------
HTTP ERROR: 500
No ServletRequest found in ThreadContext. Make sure WebUtils.bind() is
being called. (typically called by ShiroFilter) This could also
happen when running integration tests that don't properly call
WebUtils.bind().
RequestURI=/login
Caused by:
java.lang.IllegalStateException: No ServletRequest found in
ThreadContext. Make sure WebUtils.bind() is being called. (typically
called by ShiroFilter) This could also happen when running
integration tests that don't properly call WebUtils.bind().
at
org.apache.shiro.web.WebUtils.getRequiredServletRequest(WebUtils.java:351)
at
org.apache.shiro.web.session.ServletContainerSessionManager.doGetSession(ServletContainerSessionManager.java:69)
at
org.apache.shiro.session.mgt.AbstractSessionManager.getSession(AbstractSessionManager.java:246)
at
org.apache.shiro.session.mgt.AbstractSessionManager.checkValid(AbstractSessionManager.java:265)
at
org.apache.shiro.mgt.SessionsSecurityManager.checkValid(SessionsSecurityManager.java:294)
at
org.apache.shiro.mgt.DefaultSecurityManager.getSession(DefaultSecurityManager.java:196)
at
org.apache.shiro.mgt.DefaultSecurityManager.resolveSessionIfNecessary(DefaultSecurityManager.java:436)
at
org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:402)
at
org.apache.shiro.subject.SubjectBuilder.buildSubject(SubjectBuilder.java:98)
at
org.apache.shiro.web.subject.WebSubjectBuilder.buildWebSubject(WebSubjectBuilder.java:66)
at org.apache.shiro.web.servlet.ShiroFilter.bind(ShiroFilter.java:488)
at
org.apache.shiro.web.servlet.ShiroFilter.doFilterInternal(ShiroFilter.java:575)
at
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:190)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)