Hi I've been experimenting with using Springs scoped Proxy beans to handle my session bean management rather than using the more normal SessionAware interface,
<bean id = "diagnosticContext" class="com.blackbox.genesis.services.diagnostics.DiagnosticContext" scope="session"> <aop:scoped-proxy/> </bean> and injecting my session beans into the application where required. Up until now it's been working well. However, I've hit a problem with trying to access the session in an action that runs under the ExecAndWaitInterceptor and the action crashes with; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.diagnosticContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request. I have the RequestContextListener configured in my web-xml and the action that runs under the ExecAndWaitInterceptor is created through Spring using the @Controller annotation with @Scope("prototype"). I'm guessing that the problem is that the ExecAndWait interceptor creates it's own thread under which the action runs, so when it accesses the proxy bean, the proxy bean cannot see the "session" I can't use SessionAware here as the Spring documentation specifically states that Spring stores the session beans in a location that is tied to the session object - not that it stores the beans actually in the session object itself - so I'm not sure that I would be able to access the spring proxy bean reliably. While trying to find out more, I came across references in the 2.0 and 2.1 documentation to the SessionContextAutowiringInterceptor which by it's name seems a likely thing to investigate, but this isn't in Struts 2.2.1 anymore - was it redundant or has the functionality moved into another interceptor? Has anyone managed to get Spring proxied session beans working with the ExecAndWaitInterceptor? -- View this message in context: http://old.nabble.com/Using-Spring-proxied-Session-Beans-with-the-ExecAndWaitInterceptor-tp30986350p30986350.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org