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

China☆狼群 提交于 2020-01-07 02:50:28

问题


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

来源:https://stackoverflow.com/questions/40620803/http-status-500-org-hibernate-internal-util-config-configurationexception-cou

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