Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdb

博客内容提到,出现'com.mysql.jdbc.Driver'加载报错是因为MySQL驱动已更新,新的驱动类为'com.mysql.cj.jdbc.Driver'。要解决此问题,需要更新数据库驱动名称。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个错误是应为最新的mysql的驱动名称变了,把数据库驱动名称改为:

com.mysql.cj.jdbc.Driver

2019-01-05 19:34:09.005 [main] INFO  com.course.Application - Starting Application on AFOIG-801172222 with PID 13828 (C:\Users\Administrator\.ssh\workspace\muke\AutoTest\Mybatis\target\classes started by Administrator in C:\Users\Administrator\.ssh\workspace\muke\AutoTest)
2019-01-05 19:34:09.011 [main] INFO  com.course.Application - No active profile set, falling back to default profiles: default
2019-01-05 19:34:10.296 [main] WARN  org.mybatis.spring.mapper.ClassPathMapperScanner - No MyBatis mapper was found in '[com.course]' package. Please check your configuration.
2019-01-05 19:34:12.109 [main] INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8888 (http)
2019-01-05 19:34:12.151 [main] INFO  org.apache.catalina.core.StandardService - Starting service [Tomcat]
2019-01-05 19:34:12.152 [main] INFO  org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/9.0.13
2019-01-05 19:34:12.164 [main] INFO  org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;F:\python2\Scripts;F:\python2;C:\Users\Administrator\Desktop\adb1.0.32;C:\Users\Administrator\Desktop\ADB1;C:\Users\Administrator\Desktop\apache-jmeter-4.0\bin;E:\apache-ant-1.10.4\bin;C:\Users\Administrator\Desktop\apache-maven-3.5.4\bin;E:\Git\cmd;D:\Program Files\PYTHON\python3.7\Scripts\;D:\Program Files\PYTHON\python3.7\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;F:\fiddler;C:\Users\Administrator\AppData\Local\GitHubDesktop\bin;.]
2019-01-05 19:34:15.237 [main] INFO  org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2019-01-05 19:34:15.238 [main] INFO  org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 6135 ms
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2019-01-05 19:34:16.591 [main] INFO  org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
2019-01-05 19:34:18.808 [main] INFO  org.mongodb.driver.cluster - Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2019-01-05 19:34:18.888 [main] INFO  org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService 'taskScheduler'
2019-01-05 19:34:19.002 [main] INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 8888 (http) with context path ''
2019-01-05 19:34:19.008 [main] INFO  com.course.Application - Started Application in 11.253 seconds (JVM running for 14.169)
2019-01-05 19:34:20.008 [cluster-ClusterId{value='5c30963afeb04036041c88ee', description='null'}-localhost:27017] INFO  org.mongodb.driver.cluster - Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67)
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64)
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62)
	... 3 common frames omitted

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值