开发者

jersey restful + grizzly server + hibernate

开发者 https://www.devze.com 2022-12-28 08:57 出处:网络
I can bring jersey + grizzly server up. But some problem occur during \"SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory;\"

I can bring jersey + grizzly server up. But some problem occur during "SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory;" error says "SEVERE: service exception: org.hibernate.HibernateException: /hibernate.cfg.xml not fo开发者_如何学编程und

.. anyone know how to make hibernate can access hibernate.cfg.xml location.


Put it in the 'src/main/resources' directory of your project. Also, if you've specified "/hibernate.cfg.cml", try removing the slash so it reads "hibernate.cfg.xml"

If that doesn't work (no directory, classpath wrong, etc...) you can hardcode it to get it working.

File f = new File("/wherever/the/file/is/hibernate.cfg.xml"); 
sessions = new Configuration().configure(f).buildSessionFactory(); 

Then circle back later and repay your technical debt.

0

精彩评论

暂无评论...
验证码 换一张
取 消