Fork me on GitHub

IDEA资源文件xml

偶遇小坑,在此记录下。

First

Cause: java.io.IOException: Could not find resource ***.xml

看提示可知是没找到这个xml文件。
我的环境是idea+maven,检查配置发现并没有配错路径,后来在pom.xml中加入一段代码:

1
2
3
4
5
6
7
8
9
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>

src/main/java下的xml文件随同Java编译后的class文件一同copy到相应的class目录。

舒服~

Two

Tue Sep 11 19:13:16 CST 2018 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.

对于这个问题,有两个解决方法:

  • 在数据库连接的url中添加useSSL=false;
  • url中添加useSSL=true,并且提供服务器的验证证书。

如果只是做一个测试的话,没必要搞证书那么麻烦,在连接后面添加一个useSSL=false即可。例如:

1
jdbc:mysql://localhost:3306/mybatis?useSSL=false

Your support will encourage me to continue to create!