Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://127.0.0.1:3306/test'
原来的配置如下:
<?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'的更多相关文章
- JNDI数据源局部配置(解决Cannot create JDBC driver of class '' for connect URL 'null')
最开始,我是借鉴 孤傲苍狼的JNDI教程去做的,他讲得很详细,但是坏处也就是因为他讲的太详细.查了很多书,都是建议说不要用全局去配置JNDI,一是要修改tomcat的server.xml,容易破坏to ...
- 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 ...
- SQL: Cannot create JDBC driver of class '' for connect URL
使用数据库数据源的web 项目,发布后,访问数据库500报错: 浏览器端: 控制台: 数据库连接池在不启动Tomcat的情况下,测试类通过,没有问题. 一旦在服务器发布,就会出现问题,考虑是Tomca ...
- Cannot create JDBC driver of class '' for connect URL 'null'问题解决方法2
1)启动Tomcat服务器,打开浏览器,输入http://localhost:8080/admin(其中localhost是名称服务器或称为主机),进入管理界面的登陆页面,这时候请输入原来安装时要求输 ...
- 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
- mysql的驱动类com.mysql.jdbc.Driver过时了,需要用com.mysql.cj.jdbc.Driver代替
springboot项目整合mybatis,配置文件如下: server: port: 8081 mybatis: config-location: classpath:mybatis/mybatis ...
- 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 ...
- java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader.findClass(URLC ...
- 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 ...
随机推荐
- 【UNIX网络编程(二)】基本TCP套接字编程函数
基于TCP客户/server程序的套接字函数图例如以下: 运行网络I/O.一个进程必须做的第一件事就是调用socket函数.指定期望的通信协议类型. #include <sys/socket.h ...
- UVa 1583 Digit Generator(数学)
题意 假设a加上a全部数位上的数等于b时 a称为b的generator 求给定数的最小generator 给的数n是小于100,000的 考虑到全部数位和最大的数99,999的数位和也才45 ...
- oracle后台进程2
oracle中的进程共分为三类:用户进程.服务进程.后台进程.其中后台进程伴随实例的启动而启动,他们主要是维护数据库的稳定,相当于一个企业中的管理者及内部服务人员.他们并不会直接给用户提供服务. 一: ...
- 【部分枚举】【3-21个人赛】ProblemH
Problem H Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Sub ...
- JS函数的四种调用模式
函数在js中具有四种身份,分别为函数.方法.构造函数.apply或call调用 函数调用 函数调用模式中this指全局对象(window) var f1 = function() { alert ...
- NT kernel & System 占用占用80端口
问题: 1 运行'netstat -ano'发现80端口被pid=4的进程占用 2 打开任务管理器,发现pid=4的进程,其实是system进程,其对应的进程描述是NT kernel & sy ...
- hdu1711Number Sequence
Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], .... ...
- c++线程创建传递的参数发生改变
看看如下代码,觉得输出会是什么? #include "stdafx.h" #include <windows.h> #include <iostream> ...
- 图的广度优先/层次 遍历(BFS) c++ 队列实现
在之前的博文中,介绍了图的深度优先遍历,并分别进行了递归和非递归实现.BFS 无法递归实现,最广泛的实现是利用队列(queue).这与DFS的栈实现是极其相似的,甚至代码几乎都很少需要改动.从给定的起 ...
- nginx 禁止非指定域名访问
nginx 配置如下: server { listen 80 default_server; server_name _; return 404; } # server conf server { l ...