0 Replies Latest reply on Nov 28, 2008 6:42 AM by 807581

    Getting NoClassDefFoundError with ant and HibernateToolTask

      I'm trying to use the hibernate3 code generation facilities, but can't seem to get past this error. When I do "ant genJavaFromDB", I get the following error:

      java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

      I can see that the above class lives in lib/hibernate3.jar and that jar is in the classpath.

      Here is my build.xml:
      <project name="myproj" default="db" basedir=".">
         <property name="source.root" location="src"/>
         <property name="class.root" location="classes"/>
         <property name="lib.dir" location="lib"/>
         <property name="build.dir" location="build"/>
         <property name="data.dir" location="data"/>
         <property name="jdbc.driver.jar" location="${lib.dir}/mysql-connector-java-3.1.8-bin.jar"/>
         <path id="project.class.path">
            <pathelement location="${class.root}"/>
            <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
         <path id="toolslib">
            <path location="${lib.dir}/hibernate3.jar" />
            <path location="${lib.dir}/hibernate-tools.jar" />
         <target name="definetasks">
            <taskdef name="hibernatetool" 
                         classpath="${lib.dir}/hibernate-tools.jar" />
         <target name="genJavaFromDB" depends="definetasks">
            <hibernatetool destdir="${build.dir}/generated">
               <classpath refid="project.class.path" />
      Edited by: eakle on Nov 27, 2008 10:41 PM