Hibernate could not locate .cfg file eventhough it's in the source main

332 views Asked by At

I am using Intellij. Here is how the project structure looks like.

Project Structure

Here is how the DBConnect class looks like.

DBConnect

I am getting the following error: Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]

The src folder has added Hibernate framework support, the Hibernate plugin is enabled and the following lines are added to my build.gradle file:

compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.2.14.Final'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'

NB! I have tried removing the .cfg file from the resources folder to the src root folder, but with no luck.

0

There are 0 answers