[ http://issues.apache.org/struts/browse/WW-1576?page=all ] Don Brown updated WW-1576: -------------------------- Fix Version/s: 2.0.3 (was: 2.0.2) Affects Version/s: 2.0.1 (was: 2.0.2) Marking fix for 2.0.3 as xwork 2.0-rc1 is already released, which 2.0.2 will depend upon. > Spring2 "session" and "request" scopes not working > -------------------------------------------------- > > Key: WW-1576 > URL: http://issues.apache.org/struts/browse/WW-1576 > Project: Struts 2 > Issue Type: Bug > Components: Configuration > Affects Versions: 2.0.1 > Environment: Java 5, Windows Xp > Reporter: Peder Larsen > Assigned To: Don Brown > Fix For: 2.0.3 > > Attachments: struts2-spring2.zip > > > Using spring2 to inject beans on a pr session basis with scope="session" in applicationContext.xml results in stacktrace. > I try to inject the bean with this applicationContext.xml, > > > > > > > > which results in this stacktrace, > 2006-12-27 23:25:35,484 ERROR [StandardContext.java:3638] : Exception starting filter action2 > Error creating bean with name 'indexAction': Scope 'request' 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? 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. - action - file:/E:/projects/struts2-test/struts2-spring2/target/struts2-spring2-test-2.0.2-SNAPSHOT/WEB-INF/classes/struts.xml:9:44 > at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:341) > at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:291) > at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:378) > at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:242) > at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111) > at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:146) > at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) > at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:394) > at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450) > at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213) > at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223) > at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304) > at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:77) > at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634) > at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217) > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) > at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) > at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) > at org.apache.catalina.core.StandardService.start(StandardService.java:450) > at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) > at org.apache.catalina.startup.Catalina.start(Catalina.java:551) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432) > Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexAction': Scope 'request' 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? 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. > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:298) > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156) > at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:640) > at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:189) > at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:328) > ... 27 more > Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request? 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. > at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:102) > at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:40) > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:279) > ... 31 more > 27.des.2006 23:25:35 org.apache.catalina.core.StandardContext start > SEVERE: Error filterStart -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira