Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I am getting exception while running my ant task to generate the java code from my hbm files. I am using a pojo.vm which is developed as per velocity template and the same was working very well with Hibernate 2.x version. Its throwing the exception when I am trying to upgrade it to 3.1.3 version. Anyone has faced this( I dont see any topic in the forum regarding this.) Please help. Thanks
Hibernate version:
3.1.3
Mapping documents:
In my build.xml, I am using the following as per new hibernate version:-
<target name="hbm2java"
description="generates Java source files from hbm XML files">
<taskdef name="Hbm2JavaExporterTask"
classname="org.hibernate.tool.ant.Hbm2JavaExporterTask"
classpathref="compile.classpath"/>
<hibernatetool destdir="${hibernate.gensrc}">
<!-- <configuration configurationfile="conf/hibernate.cfg.xml"> -->
<configuration propertyfile="conf/hibernate.properties">
<fileset dir="${hibernate.xml}" >
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java jdk5="false"/>
<hbmtemplate templateprefix="conf/" template="conf/pojo.vm" filepattern="{class-name}.java" />
</hibernatetool>
</target>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
hbm2java:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 2. task: generic exporter
[hibernatetool] An exception occurred while running exporter #3:generic exporter
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processi
ng template conf/pojo.vm
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Could not find templ
ate with name: conf/pojo.vm.ftl
BUILD FAILED
D:\commsales\build.xml:406: org.hibernate.tool.hbm2x.ExporterException: Error wh
ile processing template conf/pojo.vm
at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToo
lTask.java:194)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:163)
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: Error while processing te
mplate conf/pojo.vm
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:252)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
ducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:101)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporte
r.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:69)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
:93)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:5
9)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:160)
... 12 more
Caused by: org.hibernate.tool.hbm2x.ExporterException: Could not find template w
ith name: conf/pojo.vm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.getTemplateName(TemplateHelpe
r.java:275)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:242)
... 23 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template conf
/pojo.vm
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:252)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro
ducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja
va:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j
ava:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi
cExporter.java:101)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporte
r.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java
:69)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java
:93)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:5
9)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.ja
va:160)
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: Could not find template w
ith name: conf/pojo.vm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.getTemplateName(TemplateHelpe
r.java:275)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe
r.java:242)
... 23 more
Total time: 7 seconds
Name and version of the database you are using:
Oracle 8i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: