0

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

  • its seems hibernate not finding the cfg.xml fiie.Add this file into your classpath. – Killer Nov 16 '16 at 05:23
  • yaa it seems that your hibernate.cfg.xml is at wrong place ... So please share your project structure ........... Or tell Inside which folder your hibernate.cfg.xml is ? – Gokul Nov 16 '16 at 11:24
  • i have uploaded my directory and added the way that i initialize my sessionFactory object. – Montaser Qasem Nov 16 '16 at 13:34

0 Answers0