spring mvc 配置 MultiActionController InternalPathMethodN

J2EE 码拜 8年前 (2016-03-18) 1272次浏览
exception
javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name “org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0” defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name “empMultiController” defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property “commandClass” of bean class [com.mvc.controller.EmpMultiController]: Bean property “commandClass” is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name “empMultiController” defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property “commandClass” of bean class [com.mvc.controller.EmpMultiController]: Bean property “commandClass” is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


root cause

org.springframework.beans.NotWritablePropertyException: Invalid property “commandClass” of bean class [com.mvc.controller.EmpMultiController]: Bean property “commandClass” is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
讨教大家,这个错误怎么解决?
解决方案

5

empMultiController这个bean里,没有叫commandClass 这个成员。
题主请把MultiActionController这个类贴一下

5

引用:

本人觉得不需要在EmpMultiController中对Emp配置set  get方法吧!

不需要set get方法。
但<property name=”xxx”> xxx是你类里的成员变量的名字。
根据你的代码commandClass 是EmpMultiController类的一个成员变量;
但你的EmpMultiController代码里,是没有 叫commandClass 的变量的,因此,很可能是存在你的父类里面。
那你的父类就是MultiActionController。
所以,本人想看看MultiActionController类,你可以down一下spring的源码,就能看到这个类的内容。
个人怀疑是,可能是spring的版本不对。

10

引用:
Quote: 引用:

http://blog.csdn.net/crazy1235/article/details/28440583
这个类的源代码太长了,本人放到上面那个连接里 了?
本人感觉不是版本的问题吧
、?~~~~本人也不确定!

本人去扫了一下源码,你这样试试
把配置文件里的那个commandClass 换成 command

sorry,本人刚才本人去down了一下代码,你需要把这<property name=”commandClass”>整行去掉,就没问题了。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明spring mvc 配置 MultiActionController InternalPathMethodN
喜欢 (0)
[1034331897@qq.com]
分享 (0)