在lib包中导入hibernate-core-1.0.12就没问题可以运行成功,输出的是:
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Hibernate:
insert
into
employee
(empName, workDate)
values
(?, ?)
在lib包中导入的是hibernate-croe-5.1.5或hibernate-croe-5.2.10,其他文件版本不影响
报错:
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Sun Apr 23 16:44:54 CST 2017 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.
且不能成功
在网上查找几乎都是加useSSL,hibernate.cfg.cml中加
<property name="hibernate.connection.autoReconnect">true</property>
<property name="hibernate.connection.useSSL">false</property>
但我仍然不能成功,我就在想是不是有什么包要导,在hibernate-release-5.1.5.Final\lib\required下的包少导一个classmate-1.3.0
导入后能运行成功:
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Sun Apr 23 16:53:10 CST 2017 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.
Hibernate:
insert
into
employee
(empName, workDate)
values
(?, ?)
删去
hibernate.cfg.cml中加的
<property name="hibernate.connection.autoReconnect">true</property>
<property name="hibernate.connection.useSSL">false</property>
仍然能运行成功,输出相同内容
删不删,都还是存在这个警告问题:Establishing SSL connection without server's identity verification is not recommended.
请知道的朋友告诉我,谢谢啦?
本文记录了解决使用Hibernate 5.x版本连接MySQL时出现的未验证服务器身份的SSL连接警告问题的过程,通过添加必要的配置和依赖项,最终实现了项目的正常运行。

1710

被折叠的 条评论
为什么被折叠?



