使用struts2时碰到这样的错误

HTTP Status 500 - Unable to instantiate Action, customerAction, defined for 'customer_toAddPage' in namespace '/'Error creating bean with name 'customerAction' defined in class path resource [customer.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [cn.itcast.action.CustomerAction]: Bean property 'userService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
type Exception report message Unable to instantiate Action, customerAction, defined for 'customer_toAddPage' in namespace '/'Error creating bean with name 'customerAction' defined in class path resource [customer.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [cn.itcast.action.CustomerAction]: Bean property 'userService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? description The server encountered an internal error that prevented it from fulfilling this request. exception Unable to instantiate Action, customerAction, defined for 'customer_toAddPage' in namespace '/'Error creating bean with name 'customerAction' defined in class path resource [customer.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [cn.itcast.action.CustomerAction]: Bean property 'userService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? - action - file:/D:/install/myeclipse2017/workspace/.metadata/.me_tcat85/webapps/ssh_crm02/WEB-INF/classes/struts.xml:14:65
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:314)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:395)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
root cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerAction' defined in class path resource [customer.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [cn.itcast.action.CustomerAction]: Bean property 'userService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1518)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:161)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:178)
com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:295)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:395)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
root cause org.springframework.beans.NotWritablePropertyException: Invalid property 'userService' of bean class [cn.itcast.action.CustomerAction]: Bean property 'userService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:231)
org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:423)
org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1514)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:161)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:178)
com.opensymphony.xwork2.factory.DefaultActionFactory.buildAction(DefaultActionFactory.java:22)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:148)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:295)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:395)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
note The full stack trace of the root cause is available in the Apache Tomcat/8.5.9 logs.

原因就是spring的配置文件中的bean写错了,经过了仔细检查发现是property和类中属性不一样的情况。

HTTP Status 500 - Unable to instantiate Action, customerAction, defined for 'customer_toAddPage' i的更多相关文章

  1. 报错HTTP Status 500 - Unable to instantiate Action

    报错如下: HTTP Status 500 - Unable to instantiate Action, visitAction, defined for 'visit_toAddPage' in ...

  2. spring与struts2整合出现错误HTTP Status 500 - Unable to instantiate Action

    在进行spring和struts2整合的时候因为大意遇到了一个问题,费了半天神终于找到了问题所在,故分享出来望广大博友引以为戒!! 我们都知道在spring和struts2整合时,spring接管了a ...

  3. SSH Spring3\Java1.8 “Unable to instantiate Action, xxAction, defined for 'xxAction_login' in namespace '/'null”

    1.Stacktraces Unable to instantiate Action,xxAction, defined for 'xxAction_login' in namespace '/'nu ...

  4. Unable to instantiate Action, xxxAction, defined for 'xxxAction' in namespace '/'xxx

    最近写SSH2的项目时,遇到一些小问题,action得不到service实例,遂将struct2委托给spring进行管理,然后修改了bean的id和action的class,但是运行后发现找不到ac ...

  5. SSH整合:Unable to instantiate Action, employeeAction, defined for 'emp-list' in namespace '/'employeeAction - action

    SSH整合,照着视频敲的,不知为何会报错,经历了快两周的折磨给解决了.记录下来给后面需要帮助的人,也算极好的了. Struts Problem Report Struts has detected a ...

  6. SSH整合报错:Unable to instantiate Action, testAction, defined for 'test' in namespace '/'testAction

    报错如下: Struts Problem Report Struts has detected an unhandled exception: Messages: testAction Unable ...

  7. 出现"Unable to instantiate Action,xxxxx, defined for 'login' in namespace '/' xxxxx 解决办法

    转自:https://blog.csdn.net/heroful/article/details/17261169 问题原因: 在MyEclipse 利用SSH框架写程序,运行时出现 " U ...

  8. 2.Unable to instantiate Action, templateAction, defined for 'template_list' in namespace '/'templateAction

    1.错误说没有命名空间'templateAction,但是在struts里写了这个,名字跟Action的名字是一样的,为什么会报这个错误 2.反复检查路径和名字,都没有问题 3.发现没有对其进行注入操 ...

  9. Unable to instantiate Action, xxxAction, defined for 'xxx' in namespace '/'xxxAction解决方式

    出现这个问题的解决办法主要有两个 1.假设项目没有使用Spring,则struts.xml配置文件里,这个action的class属性的路径没有写完整,应该是包名.类名 2.假设项目使用了Spring ...

随机推荐

  1. 巨蟒python全栈开发数据库攻略6:索引2&重要内容汇总

    1.索引的添加和删除 2.正确命中索引举例,explain优化神奇的简单使用 3.联合索引 4.简述慢日志记录 5.用户创建和权限分配 6.mysqldump逻辑备份,浅谈主从复制和读写分离 7.浅谈 ...

  2. Spoken English Practice(You know we can't afford that. How do other people do it? Other people make more twenty-four thousand a year. )

    绿色:连读:                  红色:略读:               蓝色:浊化:               橙色:弱读     下划线_为浊化 口语蜕变(2017/7/9) 英 ...

  3. VC的CListCtrl控件

    1. CListCtrl 样式及设置 2. 扩展样式设置 3. 数据插入 4. 一直选中Item 5. 选中和取消选中Item 6. 得到CListCtrl中所有行的checkbox的状态 7. 得到 ...

  4. 原!!mysql,几十万条数据中随机抽取1万以内的数据

    想了几种方法: 1.将所有符合条件的对象集合都查出来,在代码里做随机. 2.先查出所有符合条件的id,再代码随机需要抽查数量的id,再 到数据库 中 in. 3.利用order by rand() l ...

  5. Andrew Ng机器学习编程作业:Logistic Regression

    编程作业文件: machine-learning-ex2 1. Logistic Regression (逻辑回归) 有之前学生的数据,建立逻辑回归模型预测,根据两次考试结果预测一个学生是否有资格被大 ...

  6. VIM 配置python

    Pre-install sudo yum install automake gcc gcc-c++ kernel-devel cmake sudo yum install python-devel p ...

  7. [设计模式]迭代子模式 Iterator

    迭代子模式又叫做游标cursor模式,是对象的行为模式.迭代子模式可以顺序的访问一个聚集中的元素而不必暴露聚集的内部表象. 迭代子模式被广泛的应用在Java语言的API中的几个设计模式之一.在Java ...

  8. 请求库之selenium

    一 介绍 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题 selenium本质是通过驱动浏览器,完全模拟浏览器的操作, ...

  9. Xamrin开发安卓笔记(三)

    http://www.cnblogs.com/minCS/p/4118170.html Xamrin开发安卓笔记(三)   安装片 Xamrin开发安卓笔记(一) Xamrin开发安卓笔记(二) 这次 ...

  10. Java分布式:JWT(JSON Web Tokens)

    Java分布式:JWT(JSON Web Tokens) 0.优势 Session方式存储用户状态占用大量服务器内存.一般而言,大型应用还需要借助一些KV数据库和一系列缓存机制来实现Session的存 ...