HTTP Status 500 - org.hibernate.internal.util.conf

2019-09-14 08:06发布

问题:

i run my hibernate getArray function in my main class and it run successfully but when i use the same method in my jersey rest api it gives me:

HTTP Status 500 - org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]

i tried to put the method in my main class and run it and it run successfully then i tried to call it from the resource class and it didn't work! any clues here guys? This is my directory

My Directory image

And this is how i initialize the sessionFactory

File file = new File("src/main/HibernateResources/Hibernate.cfg.xml");
    sessionFactory = configuration.configure(file).buildSessionFactory(factory);

please remember the hibernate works perfectly at any other class, it's just not working the rest api resources