Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...
生活随笔
收集整理的這篇文章主要介紹了
Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Error creating bean with name 'sessionFactory' defined in class path resource 。nested exception is java.io.FileNotFoundException: class path resource [com/test/domain/Department.bhm.xml]
原錯誤大意為 : Spring初始化 applicationContext 失敗,在初始化 sessionFactory 時 失敗,因為沒有找到 *.hbm.xml 文件。
原因是:編譯后的文件中確實沒找到 *.hbm.xml 文件。
解決方法:
?? 1.? 手動復(fù)制 *.hbm.xml 文件到編譯后的目標(biāo)目錄(治標(biāo)不治本,但較為簡單)
?? 2. 在 pom.xml 中文件中增加一段代碼。
<resources><resource><directory>src/main/java</directory><includes><include>**/*.hbm.xml</include></includes></resource><resource><directory>src/main/resources</directory><includes><include>**/*.xml</include><include>**/*.properties</include></includes></resource></resources>添加的時候注意有沒有這些標(biāo)簽,沒有的話直接放在 <build></build>中即可,如果有,放在相對應(yīng)的位置,如<resources></resources>中,此時注釋掉這段代碼的<resources></resources>
轉(zhuǎn)載于:https://www.cnblogs.com/guodao/p/9702447.html
總結(jié)
以上是生活随笔為你收集整理的Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python_selenium之第一个自
- 下一篇: guava入门学习2(新集合)