Announcement Announcement Module
Collapse
No announcement yet.
solved - invalidContext exception Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • solved - invalidContext exception

    I'm getting an exception I don't understand. The docs (and the error message itself) seem to claim that running the HttpContextIntegrationFilter should be sufficent to prevent this error, but it still happens, even though the integration filter is clearly seen in the stack trace. Any ideas?

    java.lang.IllegalStateException: ContextHolder invalid: 'net.sf.acegisecurity.context.ContextImpl@1249e1a' : are your filters ordered correctly? HttpSessionCo
    ntextIntegrationFilter should have already executed by this time (look for it in the stack dump below)
    at net.sf.acegisecurity.context.security.SecureContex tUtils.getSecureContext(SecureContextUtils.java:38 )
    at net.sf.acegisecurity.ui.basicauth.BasicProcessingF ilter.doFilter(BasicProcessingFilter.java:179)
    at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:303)
    at net.sf.acegisecurity.context.HttpSessionContextInt egrationFilter.doFilter(HttpSessionContextIntegrat ionFilter.java:225)
    at net.sf.acegisecurity.util.FilterChainProxy$Virtual FilterChain.doFilter(FilterChainProxy.java:303)
    at net.sf.acegisecurity.util.FilterChainProxy.doFilte r(FilterChainProxy.java:173)
    at net.sf.acegisecurity.util.FilterToBeanProxy.doFilt er(FilterToBeanProxy.java:125)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:239)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject .java:500)
    at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:266)
    at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:183)
    at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
    at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:140)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:136)
    at org.springframework.orm.hibernate.support.OpenSess ionInViewFilter.doFilterInternal(OpenSessionInView Filter.java:172)
    at org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:239)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject .java:500)
    at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:266)
    at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:183)
    at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
    at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:140)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:136)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:534)

  • #2
    So the problem was that my HttpSessionContextIntegrationFilter was configured to use "net.sf.acegisecurity.context.ContextImpl" rather than
    "net.sf.acegisecurity.context.security.SecureConte xtImpl".

    As a suggestion, it would be nice if HttpSessionContextIntegrationFilter would fail loudly when passed an inappropriate classname for the context -- the error logs were no help to me in pinning this problem down.

    Comment


    • #3
      The current context package was intended for general-purpose use any any bindings to SecureContext would have been undesirable as it would mean the context package required Acegi Security in the classload. Or, we could have used reflection I guess.

      In any event, 0.9.0 will be refactoring all of this to use a dedicated SecurityThreadLocal. Juergen (Spring co-lead) felt a specific ThreadLocal was most appropriate, and mostly for the sake of consistency with the remainder of Spring we will be adopting this approach.

      Comment

      Working...
      X