线程“主”中的异常org.hibernate.HibernateException:无法解析配置:hibernate.cfg.xml [英] Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
本文介绍了线程“主”中的异常org.hibernate.HibernateException:无法解析配置:hibernate.cfg.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
线程main中的异常org.hibernate.HibernateException:无法解析配置:hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
在com.ClientForSave.main(ClientForSave.java:26)
导致:org.dom4j.DocumentException:连接超时:connect嵌套异常:连接超时:在org.dom4j处连接
。 io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481)
... 2 more
$ p整个堆栈跟踪
这是我的配置文件:
< hibernate-configuration>
< session-factory>
< property name =hibernate.connection.driver_class> oracle.jdbc.driver.OracleDriver< / property>
< property name =hibernate.connection.url> jdbc:oracle:thin:@localhost:1521:devt2x< / property>
< property name =hibernate.connection.username> scott< / property>
< property name =hibernate.connection.password> tiger< / property>
< property name =hibernate.dialect> org.hibernate.dialect.Oracle9Dialect< / property>
< property name =show_sql> true< / property>
< / session-factory>
< / hibernate-configuration>
解决方案我通过删除dtd的空格解决了这个问题说明。不应该有一个太空前的dtd。
I am getting the following exception:
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at com.ClientForSave.main(ClientForSave.java:26) Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) ... 2 more
Entire stack trace
Here is my config file:
<hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:devt2x</property> <property name="hibernate.connection.username">scott</property> <property name="hibernate.connection.password">tiger</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="show_sql">true</property> </session-factory> </hibernate-configuration>
解决方案I resolved this problem by deleting the spaces infront of dtd stating.There should not be a space infront of dtd.
这篇关于线程“主”中的异常org.hibernate.HibernateException:无法解析配置:hibernate.cfg.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文