*您好,我正在运行我的hibernate程序,但是发生了如下任何错误:
可以解决plz的帮助...... 这是我运行的第一个hibernate程序..
我的hibernate.cfg.xml是==>
<?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">
<hibernate-configuration>
<session-factory>
<property name="hbm2ddl.auto">update</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.url">jdbc:oracle:thin:@ACER:1521:XE</property>
<property name="connection.username">system</property>
<property name="connection.password">SHREE</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<mapping resource="employee.hbm.xml"/>
</session-factory>
</hibernate-configuration> \
错误===&GT;
ERROR: HHH000197: Error parsing XML: hibernate.cfg.xml(18) Content is not allowed in trailing section.
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2010)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1922)
at com.javatpoint.mypackage.StoreData.main(StoreData.java:13)
Caused by: org.dom4j.DocumentException: Error on line 18 of document : Content is not allowed in trailing section. Nested exception: Content is not allowed in trailing section.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2002)
... 2 more
答案 0 :(得分:0)
从
更改您的最后一行</hibernate-configuration> \
删除此斜杠---------------↑
到
</hibernate-configuration>