Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate 4.0 hibernatetool taskdef error
    text
    copied!<p>I'm using hibernate 4.0.0.CR4 and was trying the "Message" example from Java Persistence with Hibernate. I was able to compile and run the applicaiton using the ant build, but when i try exporting schema using hibernatetool i'm getting an error</p> <p>build.xml</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;project name="HelloWorld" default="compile" basedir="."&gt; &lt;property name="proj.name" value="HelloWorld"/&gt; &lt;property name="proj.version" value="1.0"/&gt; &lt;!-- Global properties for this build --&gt; &lt;property name="src.java.dir" value="src"/&gt; &lt;property name="lib.dir" value="lib"/&gt; &lt;property name="build.dir" value="bin"/&gt; &lt;path id="project.classpath"&gt; &lt;fileset dir="${lib.dir}"&gt; &lt;include name="**/*.jar"/&gt; &lt;include name="**/*.zip"/&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;!-- Useful shortcuts --&gt; &lt;patternset id="meta.files"&gt; &lt;include name="**/*.xml"/&gt; &lt;include name="**/*.properties"/&gt; &lt;/patternset&gt; &lt;!-- Cleanup --&gt; &lt;target name="clean"&gt; &lt;delete dir="${build.dir}"/&gt; &lt;mkdir dir="${build.dir}"/&gt; &lt;/target&gt; &lt;!-- Compile Java source --&gt; &lt;target name="compile" depends="clean"&gt; &lt;mkdir dir="${build.dir}"/&gt; &lt;javac srcdir="${src.java.dir}" destdir="${build.dir}" nowarn="on"&gt; &lt;classpath refid="project.classpath"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;!-- Copy metadata to build classpath --&gt; &lt;target name="copymetafiles"&gt; &lt;copy todir="${build.dir}"&gt; &lt;fileset dir="${src.java.dir}"&gt; &lt;patternset refid="meta.files"/&gt; &lt;/fileset&gt; &lt;/copy&gt; &lt;/target&gt; &lt;!--Run HelloWorld --&gt; &lt;target name="run" depends="compile, copymetafiles" description="Build and run HelloWorld"&gt; &lt;java fork="true" classname="hello.HelloWorld" classpathref="project.classpath"&gt; &lt;classpath path="${build.dir}"/&gt; &lt;/java&gt; &lt;/target&gt; &lt;!-- SchemaExporter --&gt; &lt;taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath"/&gt; &lt;target name="schemaexport" depends="compile, copymetafiles" description="Exports a generated schema to DB and files"&gt; &lt;hibernatetool destdir="${basedir}"&gt; &lt;classpath path="${build.dir}"/&gt; &lt;configuration configurationfile="${build.dir}/hibernate.cfg.xml"/&gt; &lt;hbm2ddl drop="true" create="true" export="true" outputfilename="helloworld-ddl.sql" delimiter=";" format="true"/&gt; &lt;/hibernatetool&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>error:</p> <pre><code>/home/student/workspace/HelloWorld/build.xml:61: taskdef A class needed by class org.hibernate.tool.ant.EnversHibernateToolTask cannot be found: org/hibernate/tool/ant/HibernateToolTask </code></pre> <p>following are the jars on my class path: antlr-2.7.7.jar classmate-0.5.4.jar commons-collections-3.2.1.jar commons-logging-1.1.1.jar dom4j-1.6.1.jar hibernate-commons-annotations-4.0.0.CR2.jar hibernate-core-4.0.0.CR4.jar hibernate-envers-4.0.0.CR4.jar hibernate-jpa-2.0-api-1.0.1.Final.jar hsqldb.jar jandex-1.0.3.Final.jar javassist-3.12.1.GA.jar jboss-logging-3.0.0.GA.jar jboss-transaction-api_1.1_spec-1.0.0.Final.jar</p> <p>On few forums I found that the missing class is part of hibernate-tools.jar but I couldn't find this jar in the version of hibernate (http://sourceforge.net/projects/hibernate/files/hibernate4/4.0.0.CR4/)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload