遭遇下面的莫名其妙的错误,提示 参数错误:action 和 bean 模型类型不匹配。
后来仔细检查才发现,在struts的action配置里边设置的action name,与action类里边的一个 bean 名称一样了,在传递参数时产生了歧义,修改action name为其他既可以解决。
结论: 不要把 action name的属性设置成和 action bean 一样的名称。
- 严重: Servlet.service() for servlet default threw exception
- java.lang.IllegalArgumentException: Cannot convert value of type [com.blog.Actiion.PkindAction] to required type [com.blog.Model.Pkind] for property 'pkind': no matching editors or conversion strategy found
- at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
- at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
- at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:380)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1101)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:274)
- at com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:167)
- at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:154)
- at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:128)
- at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
- at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113)
- at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275)
- at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
- at com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
- at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)
- at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
- at com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
- at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
- at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
- at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
- at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
- at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
- at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
- at java.lang.Thread.run(Unknown Source)