Im trying to generate my java-classes using hibernate-tools (3.0beta1), the eclipse-plugin works flawless but the ant-task won't produce any classes.
My ant-target (
Code:
<target name="generate-pojo"
description="Build the pojo's from hbm config">
<hibernatetool destdir="${build.dir}/bottomup">
<configuration configurationfile="${src.java.dir}/dao/hibernate.cfg.xml"><!--propertyfile="mainhibernate.properties"-->
<fileset dir="${src.java.dir}/dao">
<include name="**/*.hbm.xml" />
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>
</target>
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
<classpath>
<path refid="hibernatetool.classpath"/>
</classpath>
</taskdef>
<path id="hibernatetool.classpath">
<path refid="hibernate.classpath"/>
<pathelement location="${hibernate.tools.dir}/hibernate-tools.jar"/>
<pathelement location="${hibernate.tools.dir}/velocity-1.4.jar"/>
<pathelement location="${hibernate.tools.dir}/velocity-tools-generic-1.1.jar"/>
<pathelement location="${hibernate.tools.dir}/jtidy-r8-21122004.jar"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-collections.jar}"/>
<pathelement location="${log4j.jar}"/>
</path>
Running this gives me the following stacktrace when run in verbose.
Code:
BUILD FAILED
D:\tmp\workspace\skeleton\build.xml:144: org.hibernate.tool.hbm2x.ExporterExcept
ion: MethodInvocationException while processing template Pojo. Invocation of met
hod 'get' in class org.hibernate.tool.hbm2x.TemplateHelper$Templates threw exce
ption class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationExcepti
on while processing template pojo/PojoEqualsHashcode.vm. Invocation of method 'n
eedsEqualsHashCode' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass thre
w exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.i
sNaturalIdentifier()Z
at org.apache.tools.ant.Task.perform(Task.java:373)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException
while processing template Pojo. Invocation of method 'get' in class org.hibern
ate.tool.hbm2x.TemplateHelper$Templates threw exception class org.hibernate.tool
.hbm2x.ExporterException : MethodInvocationException while processing template p
ojo/PojoEqualsHashcode.vm. Invocation of method 'needsEqualsHashCode' in class
org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.No
SuchMethodError : org.hibernate.mapping.Property.isNaturalIdentifier()Z
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:140)
at org.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.
java:72)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.ja
va:27)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.ja
va:104)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:100)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporte
r.java:83)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:68)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
:90)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:5
8)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:144)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 10 more
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException
while processing template pojo/PojoEqualsHashcode.vm. Invocation of method 'nee
dsEqualsHashCode' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw
exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.isN
aturalIdentifier()Z
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:140)
at org.hibernate.tool.hbm2x.TemplateHelper$Templates.get(TemplateHelper.
java:98)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecut
or.java:65)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.in
voke(UberspectImpl.java:302)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
tifier.java:157)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
nce.java:220)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
:55)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java:70)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:419)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:128)
... 23 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.Property.isNatural
Identifier()Z
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.usePropertyInEquals(Basi
cPOJOClass.java:207)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(Basi
cPOJOClass.java:249)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(Basi
cPOJOClass.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.in
voke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.j
ava:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTRefe
rence.java:307)
at org.apache.velocity.runtime.parser.node.ASTAndNode.evaluate(ASTAndNod
e.java:89)
at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExp
ression.java:45)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java:68)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:419)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:128)
... 39 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while proc
essing template Pojo. Invocation of method 'get' in class org.hibernate.tool.hb
m2x.TemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.Expo
rterException : MethodInvocationException while processing template pojo/PojoEqu
alsHashcode.vm. Invocation of method 'needsEqualsHashCode' in class org.hiberna
te.tool.hbm2x.pojo.EntityPOJOClass threw exception class java.lang.NoSuchMethodE
rror : org.hibernate.mapping.Property.isNaturalIdentifier()Z
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:140)
at org.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.
java:72)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.ja
va:27)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.ja
va:104)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:100)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporte
r.java:83)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:68)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
:90)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:5
8)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:144)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException
while processing template pojo/PojoEqualsHashcode.vm. Invocation of method 'nee
dsEqualsHashCode' in class org.hibernate.tool.hbm2x.pojo.EntityPOJOClass threw
exception class java.lang.NoSuchMethodError : org.hibernate.mapping.Property.isN
aturalIdentifier()Z
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:140)
at org.hibernate.tool.hbm2x.TemplateHelper$Templates.get(TemplateHelper.
java:98)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecut
or.java:65)
at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.in
voke(UberspectImpl.java:302)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIden
tifier.java:157)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
nce.java:220)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
:55)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java:70)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:419)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:128)
... 23 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.mapping.Property.isNatural
Identifier()Z
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.usePropertyInEquals(Basi
cPOJOClass.java:207)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(Basi
cPOJOClass.java:249)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.needsEqualsHashCode(Basi
cPOJOClass.java:258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.in
voke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.j
ava:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTRefe
rence.java:307)
at org.apache.velocity.runtime.parser.node.ASTAndNode.evaluate(ASTAndNod
e.java:89)
at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExp
ression.java:45)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java:68)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.j
ava:419)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:128)
... 39 more
Any suggestions??