Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
来源:互联网 发布:mfc编程教程 编辑:程序博客网 时间:2024/05/18 05:21
Error creating bean with name ‘dataSource’ defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘classDriver’ of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property ‘classDriver’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
配置Spring的数据库链接池时出现这个意思,由于框架的配置会出现很多不同的问题。这里只写我自己遇到的(作为初学者)。
上面这个问题的大概意思是:
数据库连接池存在一个无效的classDriver 属性。
求问之后才知道,数据库连接池是别人制作出来的产品不同的数据库链接池,配置也不相同。
以下是我使用的数据库链接池:
而后面的${jdbc.jdbcUrl}等是与我之前配置的db.properties文件里面的内容一一对应。
db.properties文件
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/zycrm?characterEncoding=utf-8jdbc.driverClass=com.mysql.jdbc.Driverjdbc.user=rootjdbc.password=root
c3p0连接池的正确配置方法;
<!-- 链接数据库连接池 先开启事物,再链接数据库 --><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property></bean><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property> <property name="driverClass" value="${jdbc.driverClass}"></property> <property name="user" value="${jdbc.user}"></property> <property name="password" value="${jdbc.password}"></property></bean>
- Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
- Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Initialization of bean faile
- Error creating bean with name 'mySessionFactory' defined in class path resource [applicationContext.xml]:
- Error creating bean with name 'userLoginDAO' defined in class path resource [applicationContext.xml]
- Error creating bean with name 'bookBizImpl' defined in class path resource [applicationContext.xml]
- Error creating bean with name 'diaryDAO' defined in class path resource [applicationContext.xml]:
- Spring 整合Hibernate报错:Error creating bean with name 'dataSource' defined in class path resource
- Error creating bean with name 'dataSource' defined in class path resource
- 解决错误Error creating bean with name 'MySessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- 错误Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Error creating bean with name 'UserManger' defined in class path resource [user/applicationContext.x
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xm
- Linux命令之vi/vim
- Android中密码输入内容可见性切换
- MyBatis学习(一) 入门+例子
- js Blob对象介绍
- Struts2初学 struts.xml详解 一
- Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
- 差距(模板题)
- Semi-prime H-numbers UVA
- 人力资源中最常见的7张报表
- logstash5.5.1 的简单实用
- 云栖TechDay|第40期报名:iDST踏上的技术长征
- 怎么实现多用户同时远程连接到一台电脑上
- LeetCode-101-Symmetric Tree(判断是否为对称树)
- 欢迎使用CSDN-markdown编辑器