當(dāng)前位置:
首頁(yè) >
Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...
發(fā)布時(shí)間:2025/6/17
27
豆豆
生活随笔
收集整理的這篇文章主要介紹了
Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
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]
原錯(cuò)誤大意為 : Spring初始化 applicationContext 失敗,在初始化 sessionFactory 時(shí) 失敗,因?yàn)闆](méi)有找到 *.hbm.xml 文件。
原因是:編譯后的文件中確實(shí)沒(méi)找到 *.hbm.xml 文件。
解決方法:
?? 1.? 手動(dòng)復(fù)制 *.hbm.xml 文件到編譯后的目標(biāo)目錄(治標(biāo)不治本,但較為簡(jiǎn)單)
?? 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>添加的時(shí)候注意有沒(méi)有這些標(biāo)簽,沒(méi)有的話(huà)直接放在 <build></build>中即可,如果有,放在相對(duì)應(yīng)的位置,如<resources></resources>中,此時(shí)注釋掉這段代碼的<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...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python_selenium之第一个自
- 下一篇: guava入门学习2(新集合)