執(zhí)行測(cè)試文件時(shí)異常,控制臺(tái)沒報(bào)錯(cuò),但是報(bào)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配置文件沒有錯(cuò)的話(1、包括一些轉(zhuǎn)義字符有沒有區(qū)分,主要在數(shù)據(jù)庫連接那一項(xiàng)的jdbc:mysql://localhost:3306/hibernate_day01?useSSL=false&serverTimezone=UTC其中'&'要寫成‘&’;2、右鍵,選擇preferences查看文本編碼格式是不是utf-8;)。
二、檢查完hibernate.cfg.xml文件沒問題還無法解決那就很大原因是jdk版本問題,先試試用jdk1.8,不行再試試更低版本的
2018-09-23
jdk用的哪個(gè)版本 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 : 連接數(shù)據(jù)庫的驅(qū)動(dòng) -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- hibernate.connection.username : 連接數(shù)據(jù)庫的用戶名 -->
<property name="hibernate.connection.username">root</property>
<!-- hibernate.connection.password : 連接數(shù)據(jù)庫的密碼 -->
<property name="hibernate.connection.password">password</property>
<!-- hibernate.connection.url : 連接數(shù)據(jù)庫的地址,路徑 -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/demo1?useUnicode=true&characterEncoding=gbk&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Hongkong</property>
<!-- 數(shù)據(jù)庫方言配置 org.hibernate.dialect.MySQLDialect (選擇最短的)-->
? ? ? ? <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- show_sql: 操作數(shù)據(jù)庫時(shí),會(huì) 向控制臺(tái)打印sql語句 -->
<property name="show_sql">true</property>
<!-- format_sql: 打印sql語句前,會(huì)將sql語句先格式化 -->
<property name="format_sql">true</property>
<!-- 指定hibernate啟動(dòng)的時(shí)候自動(dòng)創(chuàng)建表結(jié)構(gòu)creat--update -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="Students.hbm.xml"/>
</session-factory>
</hibernate-configuration>
應(yīng)該不是配置的問題喲
2018-06-16
你*.cfg.xml配置有沒有問題啊