Earlier I was using Hibernate2.jar in my application and everything was find. Then I was asked to use Hibernate3.jar file for my application which is in EJB. I had to change all my hbm files and also hibernate.cfg.xml file which use hibernate3 dtds . Accordingly I have also changed my package sturctures(Hibernate 3 package structure) in the Bean class . Now when I build the application I am getting an error like ' ClassDefNotFound Exception org/hibernate/HibernateException'. If i remove this import statement for HibernateException then the error comes at the next import statement ' ClassDefNotFound Exception org/hibernate/Session'. I have all Hibernate jar files under my classpath. In eclipse it is not showing any error at the import statements for hibernate classes, but the error comes only at the build time(I m using ant build).
It seems that the jars visible to your IDE are different from those visible to ant. I have not used Eclipse in a while, but in IntelliJ I have a separate libraries for the IDE and ant (they are linked, but still removing a jar from one implies having to manually make some related changes to the other). Make sure both the IDE and ant can see the new library of jars containing hibernate3.jar.