Hibernate報錯,關於配置的SessionFactory找不到問題


  最近寫項目使用hibernate默認的dtd,在啟動項目時經常會出現這個問題,hibernate報錯,配置factory的id找不到,找不到mapping配置文件,

不能讀取配置的xml文件

Could not parse mapping document from input stream

...............

Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

 ..............

Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exception: www.hibernate.org

 ..............

查了很多資料,終於找到一個有效的解決辦法:

  在POJO類對應的xxx.hbm.xml配置文件中,將"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">改為:

 

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd",重新啟動項目,即可解決問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM