org.hibernate.HibernateException: /hibernate.cfg.xml not found in IntelliJ Project

hibernate_logo_aWhile working on a project on IntelliJ I added Hibernate, everything looked great since IntelliJ Idea 13 added the libraries and even allowed me import a schema until I hit run, then I stumble across this problem:

“org.hibernate.HibernateException: /hibernate.cfg.xml not found”

Like, “WHAT?” Wasn’t IntelliJ supposued to configure everything for me? Well, it configured everything up to a nice point but this error was a show stopper, the solution is quite simple and that is to move the hibernate.cfg.xml file to your WEB-INF/classes directory

To fixed I had to do the following.

In your project, in the WEB-INF directory, create a classes folder if it already doesn’t exist.

Look for hibernate.cfg.xml in your Project, it’s usually located at Project > src > main > java and copy it to Project > src > main > webapp > WEB-INF > classes

Hit Run and that’s it.