Hibernate异常

java.lang.ExceptionInInitializerError
at cn.hxex.blog.hibernate.HibernateUtil.(Unknown Source)
at cn.hxex.blog.test.TestUserDAO.setUp(Unknown Source)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1376)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
Caused by: org.dom4j.DocumentException: Error on line 7 of document : Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
[code="java"]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">


<!-- 数据库的URL -->

jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf8&autoReconnect=true&autoReconnectForPools=true

<!-- 数据库的驱动程序 -->

org.gjt.mm.mysql.Driver

<!-- 数据库的用户名 -->

root

<!-- 数据库的密码 -->

mysql

<!-- 数据库的Dialect -->

org.hibernate.dialect.MySQLDialect

<!-- 输出执行的SQL语句 -->
true

    <property name="hibernate.current_session_context_class">thread</property>

    <!-- HBM文件列表 -->
    <mapping resource="cn/hxex/blog/model/Message.hbm.xml"/>
    <mapping resource="cn/hxex/blog/model/ReplyMessage.hbm.xml"/>
    <mapping resource="cn/hxex/blog/model/User.hbm.xml"/>
</session-factory>


[/code]
请问这是哪的错误啊?

这是你的这个配置文件是带有BOM的utf-8文件,里面有乱码字符,
你重新创建一个新的utf-8的文件,再把之前运行没问题的hibernate.cfg.xml去拷贝部分,再修改就能解决了

[code="java"]Caused by: org.dom4j.DocumentException: Error on line 7 of document : Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence. [/code]
第8,9不要折行。