2013-04-24 80 views
0

我得到這個錯誤 -無法解析配置:hibernate.cfg.xml;該系統找不到指定的,甚至我有紅粉正確的DTD路徑

文件如何解決這個 -

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). 
log4j:WARN Please initialize the log4j system properly. 
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml 
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542) 
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1476) 
    at com.javatpoint.mypackage.StoreData.main(StoreData.java:14) 
Caused by: org.dom4j.DocumentException: C:\Users\kamlesh\workspace\empdetails\hibernate-configuration-3.0.dtd (The system cannot find the file specified) Nested exception: C:\Users\kamlesh\workspace\empdetails\hibernate-configuration-3.0.dtd (The system cannot find the file specified) 
    at org.dom4j.io.SAXReader.read(SAXReader.java:484) 
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532) 
    ... 2 more 

回答

0

是它的DOCTYPE?這是一個URL。

使用斜槓/而不是反斜槓\(即使在Windows上)。

+0

<!DOCTYPE冬眠的配置系統 「休眠配置-3.0.dtd」!> <! - 數據庫連接設置 - - > <屬性名= 「hbm2ddl.auto」> <屬性名= 「connection.driver_class」> oracle.jdbc.driver.OracleDriver <屬性名= 「connection.url」> JDBC:預言:瘦: @localhost:1521:XE system ----- org.Hibernate.dialect.OracleDialect <映射資源= 「employee.hbm.xml」/> launda 2013-04-25 07:10:15

+0

您好約翰娜, 我已經從DTD HB所作的xml文件-cg-3.0.dtd只在系統下hv lso chk從jar中提取dtd – launda 2013-04-25 07:17:04

+0

是'C:\ Users \ kamlesh \ workspace \ empdetails'你hibernate.cfg.xml所在的目錄嗎?有沒有'hibernate-configuration-3.0.dtd'文件?您也可以嘗試用'http:// hibernate.sourceforge.net/hibernate-configuration-3.0.dtd'替換'hibernate-configuration-3.0.dtd'。 – Johanna 2013-04-26 07:11:40

相關問題