ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml] in project root folder

爱⌒轻易说出口 提交于 2019-11-30 15:37:28
Aditya Gupta

If you are using Maven to build your project, place the hibernate.cfg.xml file under src/main/resources

If you are using Maven as build tool then place hibernate.cfg.xml under resources folder.

Steps to make application refer Hibernate Configuration File.

Right click the resources folder and select Mark Directory As option and click on Resources Root.

These steps worked for me in InteliJ IDEA Ultimate 14.

The hibernate.cfg.xml file should be moved to src folder.

Use forward / to put cfg file without forward / it won't work

Ravi Bandaru

I was also facing the similar issue, and I noticed that my hibernate configuration file "hibernate.cfg.xml" was not on the required path. Hence I moved hibernate.cfg.xml into src folder and that resolved the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!