org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml 问题解决



org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml 问题解决。

抛出异常: [java] org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml,

[java] Caused by: org.dom4j.DocumentException: Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence.。

这两个是同一个问题,xml文件编码不对。

原因:copy文章里的代码保存的时候,因为有中文,默认保存成了GB2312格式。解决:把hibernate.cfg.xml存成utf-8格式