-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: cfg.xml inside a jar
PostPosted: Mon Apr 04, 2005 2:24 pm 
Beginner
Beginner

Joined: Sun Feb 20, 2005 12:14 am
Posts: 49
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?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 2:36 pm 
Beginner
Beginner

Joined: Sun Feb 20, 2005 12:14 am
Posts: 49
Just after posting I realized that I had to include all the jars in the classpath by specifying them individually. I had previously done pathtomyjarfolder/*.jar. As soon as I put all my jars individually in the classpath everything started working. Sorry to have posted this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.