下面给出的是堆栈跟踪,我已经长时间坚持这个问题了,从跟踪我可以看出,使用maven作为接收器正确连接spring bean和struts进行依赖注入存在一些问题构建工具。 这里是baseAction,如果是ACTION类的名称。
2011-07-09 21:28:52,766 DEBUG [CommonsLogger.java:57] : Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@fdb413], property=struts]
2011-07-09 21:28:52,767 DEBUG [CommonsLogger.java:57] : Creating an DefaultActionProxy for namespace / and action name base
2011-07-09 21:28:52,768 DEBUG [DefaultListableBeanFactory.java:385] : No bean named 'com.app.action.BaseAction' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@169df00: defining beans [userService]; root of factory hierarchy
2011-07-09 21:28:52,769 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'actionErrors' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:52,769 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'actionMessages' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:52,770 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'fieldErrors' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:52,770 DEBUG [AbstractBeanFactory.java:214] : Returning cached instance of singleton bean 'userService'
2011-07-09 21:28:52,771 DEBUG [AbstractAutowireCapableBeanFactory.java:1033] : Added autowiring by name from bean name 'com.app.action.BaseAction' via property 'userService' to bean named 'userService'
2011-07-09 21:28:52,771 DEBUG [CommonsLogger.java:57] : intercept '//base' {
2011-07-09 21:28:52,772 DEBUG [CommonsLogger.java:57] : applied invocation context locale=en_US
2011-07-09 21:28:52,772 DEBUG [CommonsLogger.java:57] : before Locale=en_US
2011-07-09 21:28:52,772 DEBUG [CommonsLogger.java:57] : cannot find method [prepareExecute] in action [com.app.action.BaseAction@10812ac]
2011-07-09 21:28:52,773 DEBUG [CommonsLogger.java:57] : cannot find method [prepareDoExecute] in action [com.app.action.BaseAction@10812ac]
2011-07-09 21:28:52,773 DEBUG [CommonsLogger.java:57] : Setting static parameters {}
2011-07-09 21:28:52,774 DEBUG [CommonsLogger.java:57] : Setting params NONE
2011-07-09 21:28:52,774 DEBUG [CommonsLogger.java:57] : Setting params
2011-07-09 21:28:52,775 DEBUG [CommonsLogger.java:57] : Invoking validate() on action com.app.action.BaseAction@10812ac
2011-07-09 21:28:52,776 DEBUG [CommonsLogger.java:57] : cannot find method [validateExecute] in action [com.app.action.BaseAction@10812ac]
2011-07-09 21:28:52,776 DEBUG [CommonsLogger.java:57] : cannot find method [validateDoExecute] in action [com.app.action.BaseAction@10812ac]
2011-07-09 21:28:52,777 DEBUG [CommonsLogger.java:57] : Executing action method = null
2011-07-09 21:28:55,023 DEBUG [CommonsLogger.java:57] : Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@fdb413], property=struts]
2011-07-09 21:28:55,024 DEBUG [CommonsLogger.java:57] : Creating an DefaultActionProxy for namespace / and action name base
2011-07-09 21:28:55,024 DEBUG [DefaultListableBeanFactory.java:385] : No bean named 'com.app.action.BaseAction' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@169df00: defining beans [userService]; root of factory hierarchy
2011-07-09 21:28:55,025 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'actionErrors' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:55,026 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'actionMessages' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:55,026 DEBUG [AbstractAutowireCapableBeanFactory.java:1039] : Not autowiring property 'fieldErrors' of bean 'com.app.action.BaseAction' by name: no matching bean found
2011-07-09 21:28:55,027 DEBUG [AbstractBeanFactory.java:214] : Returning cached instance of singleton bean 'userService'
2011-07-09 21:28:55,027 DEBUG [AbstractAutowireCapableBeanFactory.java:1033] : Added autowiring by name from bean name 'com.app.action.BaseAction' via property 'userService' to bean named 'userService'
2011-07-09 21:28:55,028 DEBUG [CommonsLogger.java:57] : intercept '//base' {
2011-07-09 21:28:55,029 DEBUG [CommonsLogger.java:57] : applied invocation context locale=en_US
2011-07-09 21:28:55,029 DEBUG [CommonsLogger.java:57] : before Locale=en_US
2011-07-09 21:28:55,030 DEBUG [CommonsLogger.java:57] : cannot find method [prepareExecute] in action [com.app.action.BaseAction@b17e0a]
2011-07-09 21:28:55,031 DEBUG [CommonsLogger.java:57] : cannot find method [prepareDoExecute] in action [com.app.action.BaseAction@b17e0a]
2011-07-09 21:28:55,031 DEBUG [CommonsLogger.java:57] : Setting static parameters {}
2011-07-09 21:28:55,032 DEBUG [CommonsLogger.java:57] : Setting params NONE
2011-07-09 21:28:55,032 DEBUG [CommonsLogger.java:57] : Setting params
2011-07-09 21:28:55,037 DEBUG [CommonsLogger.java:57] : Invoking validate() on action com.app.action.BaseAction@b17e0a
2011-07-09 21:28:55,037 DEBUG [CommonsLogger.java:57] : cannot find method [validateExecute] in action [com.app.action.BaseAction@b17e0a]
2011-07-09 21:28:55,038 DEBUG [CommonsLogger.java:57] : cannot find method [validateDoExecute] in action [com.app.action.BaseAction@b17e0a]
2011-07-09 21:28:55,038 DEBUG [CommonsLogger.java:57] : Executing action method = null
答案 0 :(得分:0)
好的,我认为除了这一行之外,所有的日志都是绒毛:
2011-07-09 21:28:52,768 DEBUG [DefaultListableBeanFactory.java:385] : No bean named 'com.app.action.BaseAction'
found in org.springframework.beans.factory.support.DefaultListableBeanFactory@169df00: defining beans [userService];
root of factory hierarchy
当春天说它找不到那个名字的豆子时,我相信它告诉你它没有被告知这样的豆子。
签入spring context.xml (可能是WEB-INF/spring/web-application-context.xml
)文件并添加
<bean id="com.app.action.BaseAction" class="com.app.action.BaseAction" />
你的bean的声明。