出现这种问题,首先请用ie、firefox等浏览器打开该xml文件,以便检查xml文件是否有语法错误,比如标签少了配对,或乱入了某个多余字符等。。。
其次,请检查该xml文件的头部
<!--高版本hibernate的hibernate.cfg.xml文件 -->
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
上面红色这一句根据hibernate版本不同会有所不同,有可能需要改成
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">(低版本hibernate),当然,对应的hbm.xml文件头部也要修改成一样的才行。