报错:空指针异常
错误代码:
// 加载配置文件中的数据 InputStream is = JDBCUtils.class.getClassLoader().getResourceAsStream("/druid.properties");
解决办法:
去掉文件路径的/。原因不清楚。
参考网址:
https://blog.csdn.net/dragon901/article/details/79808897
https://blog.csdn.net/chengyuqiang/article/details/80114200?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
https://blog.csdn.net/dragon901/article/details/79808897
问题2:
错误代码:
init datasource error, url: jdbc:mysql:/解决办法:升级MySQL的连接文件
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.11</version> <scope>compile</scope> </dependency>
参考:https://blog.csdn.net/qq_37874220/article/details/84848850
问题3:Cannot resolve com.mysq.jdbc.Connection.ping method. Will use 'SELECT 1' instead
解决办法:
<!--druid连接池--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.10</version> </dependency>参考网址:https://blog.csdn.net/bb159632478/article/details/99618907
问题4:
Loading class `com.mysql.jdbc.Driver'. This is deprecated
解决办法:
连接配置改为:
driverClassName=com.mysql.cj.jdbc.Driver
参考网址:https://blog.csdn.net/weixin_42323802/article/details/82500458
问题5:
Establishing SSL connection without server’s identity verification is not recommended
解决办法:
参考:https://www.cnblogs.com/morganlin/p/12090944.html
按照视频教程,写了一个页面的示例,就这么多问题,是不是该放弃。。。。
------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------
转载请注明本文标题和链接:《近期学Java的几个问题的总结》
发表评论