Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'dataSource' of bean class [com.liuyang.jdbc.PersonDao]: No property 'dataSource
这个错误是说我的启动失败了。这类问题要从配置文件中开始找原因,我用的是spring框架,所以我从application.中找的原因
然后对比路径,对比文件的命名和id,都没有问题,为什么会在启动的时候找不到dataSource,我想到应该是少包,但是,找寻发现包也没有问题。
最后发现是这里错了
这里是重点:::!!!!!
我的getter和setter的方法中设置的dateSource,而配置文件想要注入的是dataSource,两个名称不一致,难怪机器找不到我的文件的class,更改
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="personDao" class="com.liuyang.jdbc.PersonDao">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
这里所有的dataSource为dateSource,或者更改类中的名称,dateSource为dataSource,连同getter和setter一起才有效。
Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'dataSource' of bean class [com.liuyang.jdbc.PersonDao]: No property 'dataSource的更多相关文章
- Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException
错误提示: defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean ...
- Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.liuyang.JDbCTemplate.PersonDao]: No default constructor fo
错误是说我的配置文件中没有对构造函数进行配置,所以找不到构造函数,在配置文件application.xml中加入如下句子: <bean id="personDao" clas ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplierAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factor
这个错误是因为抽象Action类的时候,把ServletContext写成了serverContext,导致无法注入,正确写法是 import javax.annotation.Resource; i ...
- org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jboss.resteasy.plug
之前做的项目是resteasy的上传,代码没有问题,断点都不进来呢. 我以为可以直接移植到SpringMVC,但是SpringMVC不支持MultipartFormDataInput , 用Multi ...
- Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class
查阅了资料原始JDK的问题.解决方法 1.重新安装JDK为1.7版本 2.修改配置 1.webx的依赖改为3.1.6版: <dependency> <groupId>com.a ...
- Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework
昨晚在 使用spring aop, 然后Tomcat启动的时候, 报了这么个错: Caused by: org.springframework.beans.factory.BeanCreationEx ...
- nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException
You should autowire interface AbstractManager instead of class MailManager. If you have different im ...
- Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExce
Error setting property values ; nested exception is org.springframework.beans.NotWritablePropertyExc ...
- Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeExcep
body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...
随机推荐
- Java对字符串使用MD5进行加密(亲测有效)
转自:https://blog.csdn.net/jay314159/article/details/4918358 前言: MD5即Message-Digest Algorithm 5(信息-摘要算 ...
- vue 项目部署后 刷新一下 页面找不到 解决
1.修改配置router的参数 (效果不好) 2. (不能解决 出现403) 后端配置例子 Apache <IfModule mod_rewrite.c> RewriteEngine O ...
- install命令
install 1.作用 install命令的作用是安装或升级软件或备份数据,它的使用权限是所有用户. 2.格式 (1)install [选项]... 来源 目的地 (2)install [选项].. ...
- r.js打包
久闻r.js的大名,但实际没有用它做过任何东西.今天用它时,发现网上许多教程都不对.研究一下,把我的实际经验分享给大家. 例子1 先是HTML页面 <!DOCTYPE html> < ...
- 吴裕雄 数据挖掘与分析案例实战(2)——python数据结构及方法、控制流、字符串处理、自定义函数
list1 = ['张三','男',33,'江苏','硕士','已婚',['身高178','体重72']]# 取出第一个元素print(list1[0])# 取出第四个元素print(list1[3] ...
- hive 抽样方法
select * from (select *from advert.dws_advert_order_model_sample_pcvr_v2_diwhere dt>= date_sub('$ ...
- MySQL中实现Oracle里面 rank()over ( PARTITION BY ORDER BY) 分类分组功能
各班级学生成绩测试表 select * from TMP_A; 实现目的: 按照班级分类后按照分数倒序排序 采用MySQL变量简单实现,SQL如下: SELECT a.stu_id,a.point, ...
- tesseract 4.0 编译安装(CentOS)
1.安装依赖工具 yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel 2 ...
- proc
1. /proc 下文件的内容是动态创建的,当文件可写时可用作控制和配置目的. 2. 在某个进程读取 /proc 文件时,内核会分配一个内存页,驱动程序通过这个内存页将数据返回到用户空间 (read( ...
- 可以foreach的 必须继承IEnumable 接口才行
只要是继承IEnumable 都可以用foreach遍历