Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'

启动tomcat项目时报错,项目时ssm框架

tomcat报错:

Artifact spring-redis:war exploded: Error during artifact deployment. See server log for details.

查看tomcat日志:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘ defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ‘java.lang.String‘ to required type ‘java.sql.Driver‘ for property ‘driver‘; nested exception is java.lang.IllegalStateException: Cannot convert value of type ‘java.lang.String‘ to required type ‘java.sql.Driver‘ for property ‘driver‘: no matching editors or conversion strategy found

Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'

翻译:

不能将string类型转换为driver类型,

解决办法:

配置文件中只有数据源配置用到了driver

Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'

driver接收的是一个类,driverclassname可以接收字符串,改成如下即可

Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'

正常运行

Cannot convert value of type 'java.lang.String' to required type 'java.sql.Driver' for property 'driver'

上一篇:转载——Python模拟登录代码


下一篇:c# winform 关闭窗体时同时结束线程实现思路