Re: STRUTS2 and Spring2
--- Niral Trivedi <[EMAIL PROTECTED]> wrote: > I have looked up api and spring doc for both the listeners. But I was > trying > to say, if I add RequestContextListener then Struts2 plugin gives error > saying that You have to add ContextLoaderListener. And if I add > ContextLoaderListener, spring gives error saying add > RequestContextListener. > > Can I have both listener at same time? I haven't tried doing that but will > try and see if that works.. ... Both error messages say to *add* the listener you're missing. The API docs are pretty clear that their purposes are *completely* different. The reference guide explains what both of them do. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: STRUTS2 and Spring2
Hi Dave, I have looked up api and spring doc for both the listeners. But I was trying to say, if I add RequestContextListener then Struts2 plugin gives error saying that You have to add ContextLoaderListener. And if I add ContextLoaderListener, spring gives error saying add RequestContextListener. Can I have both listener at same time? I haven't tried doing that but will try and see if that works.. Thank you. On Jan 19, 2008 8:57 AM, Dave Newton <[EMAIL PROTECTED]> wrote: > --- Niral Trivedi <[EMAIL PROTECTED]> wrote: > > We are trying to have Spring manage all the value objects and action > > objects. And so followed steps in Struts document to add struts2-spring > > plugin jar and made necessary changes but getting errors when try to > create > > a bean in session scope. Following are my configuration files: > > [...] > > [1/18/08 23:49:51:855 EST] 0032 WebAppE [Servlet > > Error]-[Error > > creating bean with name 'scopedTarget.mVO': 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? 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.]: > > [...] > > So, I tried changing web.xml and replace > > org.springframework.web.context.ContextLoaderListener with > > org.springframework.web.context.request.RequestContextListener. At that > > point, server starts up correctly, but while accessing action class, I > am > > getting error message saying : > > The reference manuals for both 2.0 and 2.5 say to *add* the > RequestContextListener [1,2], not to remove the listener that sets up your > application context. > > I'd recommend perusing the reference doc a bit more and also checking the > API > documentation for both ContextLoaderListener [3] and > RequestContextListener > [4] to understand what each of them do. > > d. > > [1] > > http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes-other > [2] > > http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-other > [3] > > http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/context/ContextLoaderListener.html > [4] > > http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/context/request/RequestContextListener.html > [tags: s2, spring, config, scope] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Struts2 and Spring2 with session scoped beans
See my reply to your first message. d. --- Niral Trivedi <[EMAIL PROTECTED]> wrote: > Hi All, > > We've are trying to use Struts2 with Spring2 on Webspher 6.1 and JDK 1.5. > Basically we are trying to use session scoped beans from Spring > applicationContext in to Struts2 using Spring DI. but running in to issue. > Following are my config files: > > web.xml > == > > struts2 > org.apache.struts2.dispatcher.FilterDispatcher > > > > struts2 > /* > > > > > org.springframework.web.context.ContextLoaderListener > > == > > Spring applicationContext.xml > == > > > http://www.springframework.org/schema/beans"; >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >xmlns:aop="http://www.springframework.org/schema/aop"; >xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > http://www.springframework.org/schema/aop > http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";> > > > > > > > > > .. > = > > When I run this configuration, I am getting following error: > == > [1/18/08 23:49:51:855 EST] 0032 WebAppE [Servlet > Error]-[Error > creating bean with name 'scopedTarget.mVO': 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? 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.]: org.springframework.beans.factory.BeanCreationException: > Error creating bean with name 'scopedTarget.mVO': 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? 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. > 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.SessionScope.get( > SessionScope.java:88) > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( > AbstractBeanFactory.java:283) > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( > AbstractBeanFactory.java:160) > at org.springframework.aop.target.SimpleBeanTargetSource.getTarget( > SimpleBeanTargetSource.java:33) > at > org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget > (Cglib2AopProxy.java:660) > at > org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept > (Cglib2AopProxy.java:610) > at > com.foo.bar.vo.MyVO$$EnhancerByCGLIB$$d821bb7e.setClassName() > at com.foo.bar.interceptors.MyInterceptor.intercept(MyInterceptor.java:56) > at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( > DefaultActionInvocation.java:224) > at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( > DefaultActionInvocation.java:223) > at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile( > UtilTimerStack.java:455) > at com.opensymphony.xwork2.DefaultActionInvocation.invoke( > DefaultActionInvocation.java:221) > at > org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java > :50) > at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java > :504) > at org.apache.struts2.dispatcher.FilterDispatcher.doFilter( >
Re: STRUTS2 and Spring2
--- Niral Trivedi <[EMAIL PROTECTED]> wrote: > We are trying to have Spring manage all the value objects and action > objects. And so followed steps in Struts document to add struts2-spring > plugin jar and made necessary changes but getting errors when try to create > a bean in session scope. Following are my configuration files: > [...] > [1/18/08 23:49:51:855 EST] 0032 WebAppE [Servlet > Error]-[Error > creating bean with name 'scopedTarget.mVO': 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? 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.]: > [...] > So, I tried changing web.xml and replace > org.springframework.web.context.ContextLoaderListener with > org.springframework.web.context.request.RequestContextListener. At that > point, server starts up correctly, but while accessing action class, I am > getting error message saying : The reference manuals for both 2.0 and 2.5 say to *add* the RequestContextListener [1,2], not to remove the listener that sets up your application context. I'd recommend perusing the reference doc a bit more and also checking the API documentation for both ContextLoaderListener [3] and RequestContextListener [4] to understand what each of them do. d. [1] http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes-other [2] http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-other [3] http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/context/ContextLoaderListener.html [4] http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/context/request/RequestContextListener.html [tags: s2, spring, config, scope] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2 and Spring2 with session scoped beans
Hi All, We've are trying to use Struts2 with Spring2 on Webspher 6.1 and JDK 1.5. Basically we are trying to use session scoped beans from Spring applicationContext in to Struts2 using Spring DI. but running in to issue. Following are my config files: web.xml == struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* org.springframework.web.context.ContextLoaderListener == Spring applicationContext.xml == http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:aop="http://www.springframework.org/schema/aop"; xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";> .. = When I run this configuration, I am getting following error: == [1/18/08 23:49:51:855 EST] 0032 WebAppE [Servlet Error]-[Error creating bean with name 'scopedTarget.mVO': 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? 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.]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.mVO': 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? 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. 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.SessionScope.get( SessionScope.java:88) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( AbstractBeanFactory.java:283) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( AbstractBeanFactory.java:160) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget( SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget (Cglib2AopProxy.java:660) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept (Cglib2AopProxy.java:610) at com.foo.bar.vo.MyVO$$EnhancerByCGLIB$$d821bb7e.setClassName() at com.foo.bar.interceptors.MyInterceptor.intercept(MyInterceptor.java:56) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile( UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke( DefaultActionInvocation.java:221) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java :50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java :504) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter( FilterDispatcher.java:419) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter( FilterInstanceWrapper.java:190) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter( WebAppFilterChain.java:130) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter( WebAppFilterChain.java:87) at com.i
STRUTS2 and Spring2
Hi All, I am using RAD7.0, JDK 1.5, Struts2 and Spring 2.x. We have been using Struts1.x and Spring 1.x for a long time now and moving our app to Struts2 + Spring2 We are trying to have Spring manage all the value objects and action objects. And so followed steps in Struts document to add struts2-spring plugin jar and made necessary changes but getting errors when try to create a bean in session scope. Following are my configuration files: web.xml == . contextConfigLocation /WEB-INF/applicationContext.xml struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* org.springframework.web.context.ContextLoaderListener = Spring applicationContext.xml http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:aop="http://www.springframework.org/schema/aop"; xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";> ... === With this configuration, server starts up correct without any issues, but when I try to access my action class, I am getting following error: = [1/18/08 23:49:51:855 EST] 0032 WebAppE [Servlet Error]-[Error creating bean with name 'scopedTarget.mVO': 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? 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.]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.mVO': 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? 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. 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.SessionScope.get( SessionScope.java:88) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:283) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:160) at org.springframework.aop.target.SimpleBeanTargetSource.getTarget( SimpleBeanTargetSource.java:33) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget (Cglib2AopProxy.java:660) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept (Cglib2AopProxy.java:610) at com.foo.bar.vo.MyVO$$EnhancerByCGLIB$$d821bb7e.setClassName () at com.foo.bar.interceptors.MyInterceptor.intercept(MyInterceptor.java :56) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling( DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile( UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionI
Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work
Hi im currently evaluating s2 and now trying to get the scope attr work in s2 and spring2. Tried all in the previous post http://www.nabble.com/Struts2-and-spring2-fails%2C-adding-RequestContextFilter-Listener-doesnt-work.-tf2872182.html#a8031133 scope post And i still got the same exception. now i got: web.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener and struts.xml i wonder if my jars dependencys are incorrect? currently i include theese ones: spring-beans-2.0.6 spring-context-2.0.6 spring-core-2.0.6 struts2-spring-plugin-2.0.6 and running s2 2.0.6 core When running the test action (the action is spring controlled, and injected by otherbeans) it works but is it under a web scope ? Exception snippet output: [10:39:21,353 DEBUG [XmlConfigurationProvider.debug] Action verification cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hellospring': 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 reque st? If you are actually operating within a web request and still receive this message,your code is pr obably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListen er or RequestContextFilter to expose the current request.] please help me out :) thanks Regards Rille -- View this message in context: http://www.nabble.com/Struts2-and-spring2-fails%2C-adding-RequestContextFilter-Listener-doesnt-work-tf3407245.html#a9491159 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Hm, then all i can think of is that i have some incompatible JARs in my pom, here is my pom.xml, 4.0.0 pedro research2 war Struts 2 Starter 1.0-SNAPSHOT Struts 2 Starter http://www.myComp.com src/main/webapp/WEB-INF/classes research2 org.mortbay.jetty maven-jetty-plugin org.apache.geronimo.specs geronimo-j2ee_1.4_spec 1.0 provided / 10 false always ignore snapshots-maven-codehaus snapshots-maven-codehaus http://snapshots.maven.codehaus.org/maven2 false always ignore apache apache http://cvs.apache.org/repository legacy apache.snapshots Apache Maven Repository (Snapshots and Test Builds) http://cvs.apache.org/maven-snapshot-repository false always ignore opensymphony opensymphony http://maven.opensymphony.com legacy junit junit 3.8.1 test org.apache.struts struts2-core 2.0.2-SNAPSHOT org.apache.struts struts2-sitemesh-plugin 2.0.2-SNAPSHOT org.apache.struts struts2-spring-plugin 2.0.2-SNAPSHOT org.springframework spring-beans org.springframework spring-context org.springframework spring-web org.springframework freemarker freemarker 2.3.4 javax.servlet servlet-api 2.4 provided javax.servlet jsp-api 2.0 provided commons-logging commons-logging 1.0.4 commons-fileupload commons-fileupload 1.1.1 uk.ltd.getahead dwr 1.1-beta-3 opensymphony sitemesh 2.2.1 org.springframework spring-beans 2.0.1 org.springframework spring-core 2.0.1 org.springframework spring-context 2.0.1 org.springframework spring-web 2.0.1 org.springframework spring-core 2.0.1 Maybe you can have a quick look, the JAR that i suspect might be some hazzle with is: org.apache.struts struts2-spring-plugin 2.0.2-SNAPSHOT for which i have defined some exclusions for to avoid fetching 1.2.x JARs. I also pass in my actual eclipse classpath so you can see what maven2 actually resolves, path="M2_REPO/org/springframework/spring-context/2.0.1/spring- context-2.0.1.jar"/> path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" /> path="M2_REPO/org/springframework/spring-core/2.0.1/spring-core-2.0.1.jar"/> path="M2_REPO/uk/ltd/getahead/dwr/1.1-beta-3/dwr-1.1-beta-3.jar"/> path="M2_REPO/commons-fileupload/commons-fileupload/1.1.1/commons- fileupload-1.1.1.jar"/> path="M2_REPO/org/springframework/spring-beans/2.0.1/spring-beans-2.0.1.jar "/> path="M2_REPO/opensymphony/xwork/2.0-RC1-SNAPSHOT/xwork-2.0-RC1-SNAPSHOT.jar "/> path="M2_REPO/org/apache/struts/struts2-spring-plugin/2.0.2-SNAPSHOT/struts2- spring-plugin-2.0.2-SNAPSHOT.jar"/> path="M2_REPO/org/apache/struts/struts2-sitemesh-plugin/2.0.2-SNAPSHOT/struts2- sitemesh-plugin-2.0.2-SNAPSHOT.jar"/> path="M2_REPO/freemarker/freemarker/2.3.4/freemarker-2.3.4.jar"/> path="M2_REPO/org/springframework/spring-web/2.0.1/spring-web-2.0.1.jar"/> path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar" /> path="M2_REPO/org/apache/struts/struts2-core/2.0.2-SNAPSHOT/struts2- core-2.0.2-SNAPSHOT.jar"/> path="M2_REPO/opensymphony/sitemesh/2.2.1/sitemesh-2.2.1.jar" /> path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/> path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/> path="M2_REPO/commons-logging/commons-logging/1.0.4/commons- logging-1.0.4.jar" /> path="M2_REPO/commons-io/commons-io/1.1/commons-io-1.1.jar" /> path="M2_REPO/ognl/ognl/2.6.9/ognl-2.6.9.jar"/> path="M2_REPO/org/apache/struts/struts2-api/2.0.2-SNAPSHOT/struts2- api-2.0.2-SNAPSHOT.jar"/> Thanks for all help so far folks, sorry for the inconvenience. Maybe i should add im using jetty6 with maven, started with mvn jetty:run Regards Peder! On 12/23/06, Nuwan Chandrasoma <[EMAIL PROTECTED]> wrote: Hi Peder, This looks ok for me, try by adding "struts.objectFactory = spring" into struts.properties file and see Thanks, Nuwan. -
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Hi Peder, This looks ok for me, try by adding "struts.objectFactory = spring" into struts.properties file and see Thanks, Nuwan. - Original Message - From: "Peder Larsen" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Saturday, December 23, 2006 3:31 AM Subject: Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work. Ok my config is: applicationContext.xml, http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:aop="http://www.springframework.org/schema/aop"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd";> struts.xml, http://struts.apache.org/dtds/struts-2.0.dtd";> /ftl/index.ftl web.xml, http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> Test webapp contextConfigLocation classpath*:applicationContext*.xml action2-cleanup org.apache.struts2.dispatcher.ActionContextCleanUp action2 org.apache.struts2.dispatcher.FilterDispatcher requestContextFilter org.springframework.web.filter.RequestContextFilter requestContextFilter /* action2-cleanup /* action2 /* org.springframework.web.context.ContextLoaderListener index.jsp Whew! That is a long listing, i've also tried with the org.springframework.web.context.request.RequestContextListener listener but run in the same problem. Also tried what nuwan chandrasoma suggested in the thread above this but i've already tried that. So anyone spots whats missing? Thanks for all help. On 12/23/06, Wendy Smoak <[EMAIL PROTECTED]> wrote: On 12/22/06, Peder Larsen <[EMAIL PROTECTED]> wrote: > I've been trying for some time now to get my basic struts2 test up and > running. The problem i have is that i need to inject one UserInfo pr session > into my FooAction. I want to use spring2 for this since it has better > "scope" support than spring1. Are you using the 2.0.1 beta release? > Anyone know what i might do to fix it? Post the relevant parts of your configuration files and code, and see if someone can spot the problem. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Ok my config is: applicationContext.xml, http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:aop="http://www.springframework.org/schema/aop"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd";> struts.xml, http://struts.apache.org/dtds/struts-2.0.dtd";> /ftl/index.ftl web.xml, http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> Test webapp contextConfigLocation classpath*:applicationContext*.xml action2-cleanup org.apache.struts2.dispatcher.ActionContextCleanUp action2 org.apache.struts2.dispatcher.FilterDispatcher requestContextFilter org.springframework.web.filter.RequestContextFilter requestContextFilter /* action2-cleanup /* action2 /* org.springframework.web.context.ContextLoaderListener index.jsp Whew! That is a long listing, i've also tried with the org.springframework.web.context.request.RequestContextListener listener but run in the same problem. Also tried what nuwan chandrasoma suggested in the thread above this but i've already tried that. So anyone spots whats missing? Thanks for all help. On 12/23/06, Wendy Smoak <[EMAIL PROTECTED]> wrote: On 12/22/06, Peder Larsen <[EMAIL PROTECTED]> wrote: > I've been trying for some time now to get my basic struts2 test up and > running. The problem i have is that i need to inject one UserInfo pr session > into my FooAction. I want to use spring2 for this since it has better > "scope" support than spring1. Are you using the 2.0.1 beta release? > Anyone know what i might do to fix it? Post the relevant parts of your configuration files and code, and see if someone can spot the problem. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Hi Peder, I have used spring2 with struts2 for a small example app.., it worked for me, i will list you what i have done. 1. I have spring 2.0 jars and struts struts 2.0 jar 2. got hold of the applicationContext.xml for spring 2.0 , which has the DTD "http://www.springframework.org/dtd/spring-beans-2.0.dtd";> 3. change the web.xml to use the the new listener that enables the scope variable in spring 2.0 org.springframework.web.context.request.RequestContextListener 4. coded my struts action they way it is mentioned in this post http://jroller.com/page/TedHusted?entry=struts_2_spring_love_fest 5. add the lines to the applictionContext.xml which i want to inject to my action, with socpe attribute speficed. 6. in my action class i have the setter and getter method and the framework will do the necessary things as i have enabled autodetect private NumberGen numGen; public NumberGen getNumGen() { return numGen; } public void setNumGen(NumberGen numGen) { this.numGen = numGen; } This is basically what i have done and its working fine for me. Thanks, Nuwan - Original Message - From: "Peder Larsen" <[EMAIL PROTECTED]> To: Sent: Saturday, December 23, 2006 1:22 AM Subject: Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work. Ok, I think it would be better if some helpful soul which has successfully used struts2 with spring2 to simply add their struts.xml, applicationContext.xmland maybe also the pom.xml for the project here so i can have a look at it. Also maybe if you have the time shorten down the XMLs to only the important parts. Tried for several days now to get this IoC with session scope working with no luck, and I'm on the verge of giving it up. I really want to use struts2 for my next project, but all this banging against the wall is frustrating. Again, best regards Peder Larsen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
On 12/22/06, Peder Larsen <[EMAIL PROTECTED]> wrote: I've been trying for some time now to get my basic struts2 test up and running. The problem i have is that i need to inject one UserInfo pr session into my FooAction. I want to use spring2 for this since it has better "scope" support than spring1. Are you using the 2.0.1 beta release? Anyone know what i might do to fix it? Post the relevant parts of your configuration files and code, and see if someone can spot the problem. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Ok, I think it would be better if some helpful soul which has successfully used struts2 with spring2 to simply add their struts.xml, applicationContext.xmland maybe also the pom.xml for the project here so i can have a look at it. Also maybe if you have the time shorten down the XMLs to only the important parts. Tried for several days now to get this IoC with session scope working with no luck, and I'm on the verge of giving it up. I really want to use struts2 for my next project, but all this banging against the wall is frustrating. Again, best regards Peder Larsen
Struts2 and spring2 fails, adding RequestContextFilter/Listener doesnt work.
Hi I've been trying for some time now to get my basic struts2 test up and running. The problem i have is that i need to inject one UserInfo pr session into my FooAction. I want to use spring2 for this since it has better "scope" support than spring1. But all my efforts (scamming through forums, beeing googly and downloading test examples) hasn't resulted in this being fixed. In the webwork2 docs it says that all i have to do is to add a filter to web.xml and everything should work nicely. I've done all detailed under "The Spring 2.0 Way" (adding the filter stuff and the new xml bean definition (xsd)). http://www.opensymphony.com/webwork/wikidocs/Spring%20Session%20Components%20Workarounds.html But all i get in the logs is: "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." Anyone know what i might do to fix it? Best regards