问题|启动Spring Boot报错-4处 @Spring Boot

描述

说明:

  • 工具:IntelliJ IDEA工具
  • 时间:2021.1.10 @艾伦
  • 记录:搭建好Spring Boot框架及基本配置后,启动Spring Boot项目,结果出现许多问题,在此记录下来,方便日后遇到相关问题时,更好的解决

问题

问题1:Application failed to start with classpath

错误:

15:41:19.809 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/D:/All_Projects/Blog/Blog_back-IDEA/bolg/target/classes/]
15:41:20.030 [restartedMain] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/D:/All_Projects/Blog/Blog_back-IDEA/bolg/target/classes/]

具体:

解决:

  • 检查配置文件,发现有错误的冒号,修改即可 低级错误

效果:


问题2:Unable to load authentication plugin ‘caching_sha2_password’

错误:

ERROR 23072 --- [  restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool  : Unable to create initial connections of pool.

java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

具体:

解决:

参考:https://blog.csdn.net/w605283073/article/details/88096598

  • 更新mysql驱动的jar版本,如:修改为8.0.11版本 版本问题

结果:(新问题的解决见→问题3)


问题3:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone

新问题:

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. 

You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决:

参考:https://www.pianshen.com/article/3239164549/

  • 在jdbc的连接 url 部分加上 serverTimezone=UTC 时区问题

结果:项目启动成功!!!只出现警告


警告4:Loading class ‘com.mysql.jdbc.Driver’. This is deprecated

参考:https://blog.csdn.net/weixin_42323802/article/details/82500458

警告-1: 驱动弃用

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.

具体:

解决-1:

  • 数据库驱动‘com.mysql.jdbc.Driver’已经被弃用,需使用新的驱动com.mysql.cj.jdbc.Driver’
  • 在jdbc的相关配置中,将com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver

警告-2: SSL连接

Sun Jan 10 20:49:14 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. 

According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. 

For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. 
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

具体:

解决-2:

  • 由于新版的mysql会询问是否SSL连接,并返回一个Boolean值
  • 所以需要手动配置true或false,来告知SSL是否连接(如:useSSL=false)

结果:警告消失


小工具推荐

YAML、YML在线编辑器(格式化校验)解析工具

https://www.toolfk.com/tool-format-yaml


全部评论

相关推荐

点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-10 13:54
点赞 评论 收藏
分享
05-26 10:24
门头沟学院 Java
qq乃乃好喝到咩噗茶:其实是对的,线上面试容易被人当野怪刷了
找工作时遇到的神仙HR
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 16:15
我应届生,去年10月份开始在这家公司实习,到今年10月份正好一年想(实习+试用期),在想要不要提前9月份就离职,这样好找工作些,但又差一个月满一年,又怕10月份国庆回来离职,容易错过了下半年的金九银十,到年底容易gap到年后
小破站_程序员YT:说这家公司不好吧,你干了快一年 说这家公司好吧,你刚毕业就想跑路说你不懂行情吧,你怕错过金九银十说 你懂行情吧,校招阶段在实习,毕业社招想换工作 哥们,我该怎么劝你留下来呢
应届生,你找到工作了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务