views:

159

answers:

1

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 found

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

A: 

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.

gmoore