org.hibernate.HibernateException - 无法解析配置 [英] org.hibernate.HibernateException- Could not parse configuration
本文介绍了org.hibernate.HibernateException - 无法解析配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
线程main中的异常org.hibernate.HibernateException:无法
解析配置:hibernate.cfg.xml
这是我的xml文件
< hibernate-configuration>
< session-factory>
< property name =show_sql> true< / property>
< property name =hbm2ddl.auto>建立< / property>
< property name =dialect> org.hibernate.dialect.Oracle9Dialect< / property>
< property name =connection.url> jdbc:oracle:thin:@localhost:1521:xe< / property>
< property name =connection.username>系统< / property>
< property name =connection.password> 123< / property>
< property name =connection.driver_class> oracle.jdbc.driver.OracleDriver< / property>
< mapping class =com.java.utils.Details>< / mapping>
< / session-factory>
< / hibernate-configuration>
解决方案
p>
- XML声明存在
- XML声明应该放在第一行,不应该有任何空间。
- xml不会在任何地方使用。
hibernate.cfg.xml(2) The processing instruction target matching "[xX][mM][lL]" is not allowed.
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
this is my xml file
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="connection.username">system</property>
<property name="connection.password">123</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<mapping class="com.java.utils.Details"></mapping>
</session-factory>
</hibernate-configuration>
解决方案
Can you check these things:
- XML declaration is present
- XML declaration should be on first line and there should not be any space before this.
- xml is not used anywhere.
这篇关于org.hibernate.HibernateException - 无法解析配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文