Struts的action自動裝配到spring_第1頁
Struts的action自動裝配到spring_第2頁
Struts的action自動裝配到spring_第3頁
Struts的action自動裝配到spring_第4頁
Struts的action自動裝配到spring_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Struts 在與 Spring 整合是要實現(xiàn) Struts 的 action 自動裝配到 spring 容器中,我們經常遇到的問題是:java.lang.NullPointException 這個空指針異常,我碰到的有這么幾種解決方案:1.看一下你的 set 方法是否存在。2.是否在 web.xml 中配置了 “當 web 項目啟動的時候,讓 spring 掃描整個項目。 ”,當然也要加上一個名為:struts-spring-plugin*.jar的包,這個包實現(xiàn)了action裝配到 spring 的功能。(如果已經加了這個包,也配置了 web.xml 還出現(xiàn)空指針異常,那么可能是你的 st

2、ruts-spring-plugin*.jar 的版本不配套, 還幾個版本試試)web.xml 中添加的配置(添加在 Struts 配置的前面):htmlview .springframework.web.context.ContextLoaderListener3.4.5.contextConfigLocation6.classpath:bean.xml7.當你已經完成上面描述的配置的時候,還可能出現(xiàn)下面的這個異常,異常信息如下(這個是瀏覽器報的異常,后臺沒有異常,服務器啟動正常):plainview plaincopy1.Struts Problem Rep

3、ort2.3.Struts has detected an unhandled exception:4.5.Messages:6.Cannot convert value of type xy.$Proxy8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImpl

4、for property userServiceImpl: no matchi ngeditors or conversion strategy found7.Failed to convert property value of type xy.$Proxy8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.s

5、erviceimpl.UserServiceImpl for property userServiceImpl ;nested exception is java.lang.IllegalArgumentException: Cannot conv ertvalue of type xy.$Proxy8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required

6、 type com.zsq.wxssh.serviceimpl.UserServiceImpl for property userServiceImpl: no matchingeditors or conversion strategy found8.Unable to instantiate Action, com.zsq.wxssh.action.LoginAction, define d for Login in namespace /Failed toconvert property value of type xy.$Proxy8 implementingco

7、m.zsq.wxssh.service.UserService ,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImplfor property userServiceImpl; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type xy.$P

8、roxy8implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advisedype com.zsq.wxssh.serviceimpl.UserServiceImpl for property userServiceImpl: no matching editors or conversion strategy found9.File: org/springframework/beans/TypeConverter

9、Delegate.java10.Line number: 23111.Stacktraces12.13.Unable to instantiate Action, com.zsq.wxssh.action.LoginAction, define d for Login in namespace /Failed toconvert property value of type xy.$Proxy8 implementingcom.zsq.wxssh.service.UserService ,org.springframework.aop.SpringProxy,org.sp

10、ringframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImplfor property userServiceImpl; nested exception is java.lang.Illegalto required tArgumentException: Cannot convert value of type xy.$Proxy8implementing com.zsq.wxssh.service.UserService,org.spring

11、framework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImpl for property userServiceImpl: no matching editors or conversion strategy .opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316).opensymp

12、hony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397).opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)17.org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)18.org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(S

13、trutsActionProxyFactory.java:39).opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)20.org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)21.org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:

14、77)22.org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)23.org.apache.catalina.core.ApplicationFilterCernalDoFilter(ApplicationFilterChain.java:235)24.org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter

15、Chain.java:206)25.org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)26.org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)27.org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)28.org.apache.catalina.valves.Err

16、orReportValve.invoke(ErrorReportValve.java:103)29.org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)30.org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)31.org.apache.coyote.http11.Http11AprPcess(Http11AprProcessor.java:879)32.org.a

17、pache.coyote.http11.Http11AprProtocol$Http11ConnectionHcess(Http11AprProtocol.java:600).AprEndpoint$Worker.run(AprEndpoint.java :1703)34.java.lang.Thread.run(Thread.java:724)35.36.org.springframework.beans.TypeMismatchException: Failed to convert property value of type xy.$Proxy

18、8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImpl for property userServiceImpl; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type

19、 xy.$Proxy8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImpl forproperty userServiceImpl: no matching editors or conversion strategy .springfra

20、mework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)38.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)39.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.app

21、lyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)40.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)41.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperti

22、es(AbstractAutowireCapableBeanFactory.java:329).opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:203).opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:183).opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactor

23、y.java:154).opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151).opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121).opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297).opensymphony.xwork2.DefaultActionInvocation.init(DefaultAct

24、ionInvocation.java:397).opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)50.org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)51.org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39).opensymphony.xwork

25、2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)53.org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)54.org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)55.org.apache.struts2.dispatcher.ng.filter.Strut

26、sPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)56.org.apache.catalina.core.ApplicationFilterCernalDoFilter(ApplicationFilterChain.java:235)57.org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)58.org.apache.catalina.core.Standard

27、WrapperValve.invoke(StandardWrapperValve.java:233)59.org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)60.org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)61.org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)62.o

28、rg.apache.catalina.core.StandardEngineValve.invoke(StandardE.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)64.org.apache.coyote.http11.Http11AprPcess(Http11AprProcessor.java:879)65.org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHc

29、ess(Http11AprProtocol.java:600).AprEndpoint$Worker.run(AprEndpoint.java :1703)67.java.lang.Thread.run(Thread.java:724)68.69.java.lang.IllegalArgumentException: Cannot convert value of type xy.$Proxy8 implementing com.zsq.wxssh.service.UserService,org.springframework.aop.SpringProxy,org.sp

30、ringframework.aop.framework.Advised to required type com.zsq.wxssh.serviceimpl.UserServiceImpl for p ropertyuserServiceImpl: no matching editors or conversion strategy .springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)71.org.springframework.bea

31、ns.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)72.org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)73.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.ja

32、va:1289)74.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)75.org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)76.org.sp

33、ringframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329).opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:203).opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFa

34、ctory.java:183).opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154).opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151).opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121).opensymphony.xwork2.DefaultActionInvocation.createAction(De

35、faultActionInvocation.java:297).opensymphony.xwork2.DefaultActionInvocation.init(DefaultA.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)85.org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)86.org.apache.struts2.impl.StrutsActionProxyFactory.crea

36、teActionProxy(StrutsActionProxyFactory.java:39).opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)88.org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)89.org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteO

37、perations.java:77)90.org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)91.org.apache.catalina.core.ApplicationFilterCernalDoFilter(ApplicationFilterChain.java:235)92.org.apache.catalina.core.ApplicationFilterChain.doFilter(Ap

38、plicationFilterChain.java:206)93.org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)94.org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)95.org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)96.org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportV

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論