I am creating a myjar.jar file that includes the hibernate.cfg.xml for my application. I have a TestSuite that I need to run therefore I include the myjar.jar file in the classpath and execute my test case. I get an exception.
I can get my TestSuite to execute fine if I include the compiled classes and the hibernate.cfg.xml to my classpath as opposed to creating a jar and including them.
Hibernate version: 3.0
Full stack trace of any exception that occurs:
Code:
java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at com.ac.t.persistence.daos.DAOTestCase.setUp(DAOTestCase.java:21)
at com.ac.t.persistence.daos.DAOTestSuite.main(DAOTestSuite.java:18)
Code:
Configuration cfg = new Configuration();
sessionFactory = cfg.configure().buildSessionFactory();
Session tmpSession = null;
tmpSession = sessionFactory.openSession();
From what I understand the hibernate.cfg.xml file needs to be in the classpath of the application. I do this by including the myjar.jar in my classpath , which has the hibernate.cfg.xml file. Where am I going wrong?