Re: Incorrect Bean Injected
Ok that's what I figured. I have already extended the StrutsSpringObjectFactory to do this. Thanks, Tim Musachy Barroso wrote: Not any time soon. You can either build from trunk, or create your own factory that extends StrutsSpringObjectFactory, and overwrite the methods(2) with the fix (quick and dirty solution). musachy On Fri, Jan 16, 2009 at 2:50 PM, Timothy Orme to...@genome.med.harvard.edu wrote: Excellent, thank you! Just out of curiosity, what would the release timeline be on this? Thanks, Tim Musachy Barroso wrote: I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set struts.objectFactory.spring.autoWire to no. The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used no instead of none. musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme to...@genome.med.harvard.edu wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Incorrect Bean Injected
Tim/Musachy Was http://issues.apache.org/struts/browse/WW-2479 resolved and incorporated into current distro? if applicationContext.xml contains: bean id=stringBean class=java.lang.String autowire-candidate=false constructor-arg value=${stringBean}/ /bean --do not autowire stringBean If so ..should we change struts-config.xml from struts bean type=com.opensymphony.xwork2.ObjectFactory name=spring class=org.apache.struts2.spring.StrutsSpringObjectFactory / !-- Make the Spring object factory the automatic default -- constant name=struts.objectFactory value=spring / package name=spring-default interceptors interceptor name=autowiring class=com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor/ interceptor name=sessionAutowiring class=org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor/ /interceptors /package /struts to.. configure autowire attribute set to no struts bean type=com.opensymphony.xwork2.ObjectFactory name=spring class=org.apache.struts2.spring.StrutsSpringObjectFactory autowire=no/ !-- Make the Spring object factory the automatic default -- constant name=struts.objectFactory value=spring / package name=spring-default interceptors interceptor name=autowiring class=com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor/ interceptor name=sessionAutowiring class=org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor/ /interceptors /package /struts ? Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Thu, 22 Jan 2009 09:45:04 -0500 From: to...@genome.med.harvard.edu To: user@struts.apache.org Subject: Re: Incorrect Bean Injected Ok that's what I figured. I have already extended the StrutsSpringObjectFactory to do this. Thanks, Tim Musachy Barroso wrote: Not any time soon. You can either build from trunk, or create your own factory that extends StrutsSpringObjectFactory, and overwrite the methods(2) with the fix (quick and dirty solution). musachy On Fri, Jan 16, 2009 at 2:50 PM, Timothy Orme to...@genome.med.harvard.edu wrote: Excellent, thank you! Just out of curiosity, what would the release timeline be on this? Thanks, Tim Musachy Barroso wrote: I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set struts.objectFactory.spring.autoWire to no. The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used no instead of none. musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme to...@genome.med.harvard.edu wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say
Re: Incorrect Bean Injected
So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
Here is the link to the feature request. https://issues.apache.org/struts/browse/WW-2765 Timothy Orme wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Incorrect Bean Injected
Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Incorrect Bean Injected
You can de-autowire an action by creating an XML configuration for it. Then you can use the spring name instead of the class in the action config bean id=myAction class=com.actions.MyAction property name=myManager ref=userService/ /bean bean id=myOtherAction class=com.actions.MyAction property name=myManager ref=otherUserService/ /bean struts.xml action name=something class=myAction.../action action name=somethingElse class=myOtherAction.../action That way you get the benefit of autowiring for your simple stuff and you can use XML config for your more exotic Spring injections. Relph,Brian wrote: Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Incorrect-Bean-Injected-tp21502777p21504674.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
Re: Incorrect Bean Injected
Yeah, I tried both none as well as no and neither had any effect. Relph,Brian wrote: Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Incorrect Bean Injected
Tim- http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes scope=prototype would specify a single Bean would cover n number instances HTH Martin Gainty __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Fri, 16 Jan 2009 12:50:14 -0500 From: to...@genome.med.harvard.edu To: user@struts.apache.org Subject: Re: Incorrect Bean Injected Yeah, I tried both none as well as no and neither had any effect. Relph,Brian wrote: Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
Martin Gainty wrote: http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes scope=prototype would specify a single Bean would cover n number instances Not sure that matters for auto-wiring. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
This is what I had done in my example I originally specified. As I stated, it seems that on startup my XML is used but then when I hit the action, struts builds a new instance and ignores my XML specs. -Tim dusty wrote: You can de-autowire an action by creating an XML configuration for it. Then you can use the spring name instead of the class in the action config bean id=myAction class=com.actions.MyAction property name=myManager ref=userService/ /bean bean id=myOtherAction class=com.actions.MyAction property name=myManager ref=otherUserService/ /bean struts.xml action name=something class=myAction.../action action name=somethingElse class=myOtherAction.../action That way you get the benefit of autowiring for your simple stuff and you can use XML config for your more exotic Spring injections. Relph,Brian wrote: Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
I'm not sure exactly how this pertains to the matter at hand. Are you suggesting that I make my action beans set to prototype? If so, I had tried this as well to no avail. As I'm using the Struts Spring plugin for my object factory I'm assuming that it's going to try and autowire every instance that is made anyhow. If I misunderstood what you're hinting at, please let me know. Thanks, Tim Martin Gainty wrote: Tim- http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes scope=prototype would specify a single Bean would cover n number instances HTH Martin Gainty __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Fri, 16 Jan 2009 12:50:14 -0500 From: to...@genome.med.harvard.edu To: user@struts.apache.org Subject: Re: Incorrect Bean Injected Yeah, I tried both none as well as no and neither had any effect. Relph,Brian wrote: Did you try setting the value=none? Brian Relph -Original Message- From: Timothy Orme [mailto:to...@genome.med.harvard.edu] Sent: Friday, January 16, 2009 10:41 AM To: Struts Users Mailing List Subject: Re: Incorrect Bean Injected So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set struts.objectFactory.spring.autoWire to no. The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used no instead of none. musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme to...@genome.med.harvard.edu wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
Excellent, thank you! Just out of curiosity, what would the release timeline be on this? Thanks, Tim Musachy Barroso wrote: I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set struts.objectFactory.spring.autoWire to no. The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used no instead of none. musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme to...@genome.med.harvard.edu wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Incorrect Bean Injected
Not any time soon. You can either build from trunk, or create your own factory that extends StrutsSpringObjectFactory, and overwrite the methods(2) with the fix (quick and dirty solution). musachy On Fri, Jan 16, 2009 at 2:50 PM, Timothy Orme to...@genome.med.harvard.edu wrote: Excellent, thank you! Just out of curiosity, what would the release timeline be on this? Thanks, Tim Musachy Barroso wrote: I looked at the code and it cannot be set to none. I fixed it in struts and xwork trunks, so in the future you will be able to set struts.objectFactory.spring.autoWire to no. The spring value is AutowireCapableBeanFactory.AUTOWIRE_NO, so I followed the pattern and used no instead of none. musachy On Fri, Jan 16, 2009 at 11:41 AM, Timothy Orme to...@genome.med.harvard.edu wrote: So scratch that, I figured out that Struts is set to autowire by default with the spring plugin. In my struts.xml I have: constant name=struts.objectFactory value=org.apache.struts2.spring.StrutsSpringObjectFactory / constant name=struts.objectFactory.spring.autoWire value=type / And am now autowiring by type instead of name. However, does anyone know how to turn off autowiring altogether? I've seen a feature request for this, but it hasn't been filled yet. Has anyone devised a workaround? Thanks, Tim Orme Timothy Orme wrote: This seems really strange to me, but I don't know the inner workings of struts enough to know if it's expected behavior. I'm using Struts 2.1.2 and spring 2.5.3 I have a 2 service beans that have the same name, but depending on the action, one might be used instead of the other. bean id=hibernateUserService class=hibernate.service.impl.LoginUserServiceImpl /bean bean id=sqlUserService class=sql.service.impl.LoginUserServiceImpl /bean bean id=submitQuoteAction class=action.quotes.SubmitQuoteAction property name=userService ref=hibernateUserService / /bean bean id=registerUserAction class=action.users.RegisterUserAction property name=userService ref=sqlUserService/ /bean So I have 2 beans, each serving a similar purpose, so named the same, but used in different actions. What happens is, at the webapp startup, I see the beans get injected into the actions fine. The types are correct, and the property is set. The server starts without any issues. However, whats strange is that when I try and go to either action I get a null pointer for the userService objects in both actions. I did notice though, that if I name one of the service beans to just userService instead of say, hibernateUserService then one of the actions will work correctly, while the other will fail saying that it cant cast sql.service.impl.LoginUserServiceImpl to hibernate.service.impl.LoginUserServiceImpl. It seems then that Struts is wiring the properties by bean name and overriding the beans that I have specified in my applicationContext. Does anyone know what would cause this or how to work around it? Thanks, Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org