原来的配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"></property>
     <!--<property name="url" value="jdbc:mysql://localhost/test?user=root&password=root" />-->
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
</beans>

项目部署时没有报错,在进行增删改查时报错:Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://127.0.0.1:3306/test'

错误信息的意思是没有找到driver,仔细一看,在dataSource中少了driver这个属性,加上即可,正确配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<!--添加Driver-->
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"></property>
<property name="username" value="root"></property>
<property name="password" value="xuexi"></property>
</bean>
</beans>

Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://127.0.0.1:3306/test'的更多相关文章

  1. JNDI数据源局部配置(解决Cannot create JDBC driver of class '' for connect URL 'null')

    最开始,我是借鉴 孤傲苍狼的JNDI教程去做的,他讲得很详细,但是坏处也就是因为他讲的太详细.查了很多书,都是建议说不要用全局去配置JNDI,一是要修改tomcat的server.xml,容易破坏to ...

  2. SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法

    当跑jndi项目时抛出:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' fo ...

  3. SQL: Cannot create JDBC driver of class '' for connect URL

    使用数据库数据源的web 项目,发布后,访问数据库500报错: 浏览器端: 控制台: 数据库连接池在不启动Tomcat的情况下,测试类通过,没有问题. 一旦在服务器发布,就会出现问题,考虑是Tomca ...

  4. Cannot create JDBC driver of class '' for connect URL 'null'问题解决方法2

    1)启动Tomcat服务器,打开浏览器,输入http://localhost:8080/admin(其中localhost是名称服务器或称为主机),进入管理界面的登陆页面,这时候请输入原来安装时要求输 ...

  5. birt 访问频繁报错Cannot create JDBC driver of class '' for connect URL 'null' java.sql.SQLException: No suitable driver

    一般birt项目都是部署tomcat启动.这个问题大概率是因为没有配置JNDI数据源的原因. 参考链接: https://www.cnblogs.com/xdp-gacl/p/3951952.html

  6. mysql的驱动类com.mysql.jdbc.Driver过时了,需要用com.mysql.cj.jdbc.Driver代替

    springboot项目整合mybatis,配置文件如下: server: port: 8081 mybatis: config-location: classpath:mybatis/mybatis ...

  7. Mysql版本java问题(com.mysql.cj.jdbc.Driver和com.mysql.jdbc.Driver)

    老版本com.mysql.jdbc.Driver已弃用 String url1 = "jabc:mysql://127.0.0.1:3306/test"; String url1 ...

  8. java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver

    java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader.findClass(URLC ...

  9. Build an ETL Pipeline With Kafka Connect via JDBC Connectors

    This article is an in-depth tutorial for using Kafka to move data from PostgreSQL to Hadoop HDFS via ...

随机推荐

  1. Android学习之SharedPreferences类

    SharedPreferences类 android.content.SharedPreferences 类概括: 访问和修改由函数getSharedPreferences(String,int)返回 ...

  2. 如何不让oracle使用linux的swap分区

    经常看到swap分区被使用,被缓存的内容本来是为了增加命中率,结果去不断换入换出,导致本地磁盘IO增加,影响访问速度.所以在内存充足的情况下,如果我们觉得不需要使用swap分区的时候,那就要想办法尽量 ...

  3. HDU2594——Simpsons’ Hidden Talents

    Problem Description Homer: Marge, I just figured out a way to discover some of the talents we weren’ ...

  4. android soundpool 參数说明

    SoundPool 类的构造函数例如以下: SoundPool(int maxStreams, int streamType, int srcQuality) 作用:实例化一个SoundPool 实例 ...

  5. 【字母树+贪心】【HDU3460】【Ancient Printer】

    题目大意: 一个打印机 只有 打印,删除,a-z.操作 给你一堆队名,如何才能操作次数最少输出全部 (字典树节点数-1)*2 输入,删除操作数 字符串数 printf操作数 最长字符串的长度 最后一个 ...

  6. vs2010安装svn插件

    vs2010安装svn插件及简单使用 1.下载安装程序,安装 2.配置vs2010 3.check out工程 1.下载安装程序,安装 2.配置vs2010 3.check out工程 Open th ...

  7. 自定义按照index和key访问的List

    List<T>用起来比较方便,但是有时候要按照Index来访问List中的对象有些繁琐,所以想是不是扩展一下,既能按照Index来访问,又能按照Key访问. 实现方法: public cl ...

  8. SWFUpload的使用及其注意事项

    SWFUpload的使用: 添加Jquery    swfuploaad.js  handler.js文件 配置参数: upload_url:文件将要被传到的处理程序 post_params:{“”: ...

  9. 第五章SignalR的实时高频通讯

    第五章SignalR的实时高频通讯 概述:本例子演示了如果创建一个对象与其他浏览器共享实时状态的应用程序.我们要创建的应用程序为“MoveShape”,该MoveShape页面会显示一个Html Di ...

  10. TCP/IP详解之:IP选路 动态选路协议

    第九章 IP选路 netstat -rn 显示路由表 初始化路由表的两种方法: 方法1:在配置文件中指定静态路由(不常用) 方法2:运行路由守护程序 或者 使用ICMP路由器发现报文 没有到达目的地的 ...