I created a project with following structure:
HibernateUtil:
Another reason why this exception occurs is if you call the configure method twice on a Configuration
or AnnotatedConfiguration
object like this -
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass(MyClass.class);
//Use this if config files are in src folder
config.configure();
//Use this if config files are in a subfolder of src, such as "resources"
config.configure("/resources/hibernate.cfg.xml");
Btw, this project structure is inside eclipse.