執行測試文件時異常,控制臺沒報錯,但是報hibernate.properties not found
六月 15, 2018 4:47:51 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.3.0.Final}
六月 15, 2018 4:47:51 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in RESOURCE hibernate.cfg.xml. Message: null
java. lang .Null Pointer Exception
at StudentsTest.destory(StudentsTest.java:34)
?. unmarshal ?exception
2020-06-10
一、如果hibernate.cfg.xml配置文件沒有錯的話(1、包括一些轉義字符有沒有區分,主要在數據庫連接那一項的jdbc:mysql://localhost:3306/hibernate_day01?useSSL=false&serverTimezone=UTC其中'&'要寫成‘&’;2、右鍵,選擇preferences查看文本編碼格式是不是utf-8;)。
二、檢查完hibernate.cfg.xml文件沒問題還無法解決那就很大原因是jdk版本問題,先試試用jdk1.8,不行再試試更低版本的
2018-09-23
jdk用的哪個版本 1.8試一試,
2018-06-17
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
? ? ? ? <!-- hibernate.connection.driver_class : 連接數據庫的驅動 -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- hibernate.connection.username : 連接數據庫的用戶名 -->
<property name="hibernate.connection.username">root</property>
<!-- hibernate.connection.password : 連接數據庫的密碼 -->
<property name="hibernate.connection.password">password</property>
<!-- hibernate.connection.url : 連接數據庫的地址,路徑 -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/demo1?useUnicode=true&characterEncoding=gbk&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Hongkong</property>
<!-- 數據庫方言配置 org.hibernate.dialect.MySQLDialect (選擇最短的)-->
? ? ? ? <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- show_sql: 操作數據庫時,會 向控制臺打印sql語句 -->
<property name="show_sql">true</property>
<!-- format_sql: 打印sql語句前,會將sql語句先格式化 -->
<property name="format_sql">true</property>
<!-- 指定hibernate啟動的時候自動創建表結構creat--update -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="Students.hbm.xml"/>
</session-factory>
</hibernate-configuration>
應該不是配置的問題喲
2018-06-16
你*.cfg.xml配置有沒有問題啊