Hello all!
Version:
Windows 2000 SP4, Hibernate3, HibernateTools 3.1 Beta4, Oracle 9i, Java 1.4.2
Issue
Cannot generate code from custom daohome.vm
I have also tried without modifying.
Exception
D:\cvs\blah\www\bin\build.xml:188: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while pr
ocessing template templates/dao/daohome.vm. Invocation of method 'getJavaTypeName' in class org.hibernate.tool.hbm2x.Cf
g2JavaTool threw exception class java.lang.NullPointerException : null
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(DefaultExecutor.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 templates/dao
/daohome.vm. Invocation of method 'getJavaTypeName' in class org.hibernate.tool.hbm2x.Cfg2JavaTool threw exception clas
s java.lang.NullPointerException : null
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:150)
at org.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:74)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:28)
at org.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:112)
at org.hibernate.tool.hbm2x.GenericExporter.exportComponent(GenericExporter.java:96)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:90)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:68)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:92)
at org.hibernate.tool.hbm2x.GenericExporter.start(GenericExporter.java:58)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
... 10 more
Caused by: java.lang.NullPointerException
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getMetaAsString(Cfg2JavaTool.java:76)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:166)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:162)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:89)
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.java:450)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:138)
... 23 more
build.xml
<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpath=" ${lib.dir}/Hibernate/hibernate-tools.jar;
${lib.dir}/Hibernate/hibernate3.jar;
${lib.dir}/Hibernate/velocity-1.4.jar;
${lib.dir}/Hibernate/commons-logging-1.0.4.jar;
${lib.dir}/Hibernate/jtidy-r8-21122004.jar;
${lib.dir}/Hibernate/dom4j-1.6.1.jar;
${lib.dir}/ojdbc14-9205.jar;
${lib.dir}/Hibernate/ehcache-1.1.jar;
${lib.dir}/Hibernate/cglib-2.1.3.jar;
${lib.dir}/Hibernate/asm.jar;
${lib.dir}/Hibernate/commons-collections-2.1.1.jar;
${lib.dir}/Hibernate/velocity-tools-generic-1.1.jar"/>
<hibernatetool destdir="${build.classes.dir}">
<jdbcconfiguration configurationfile="../configuration/Hibernate/hibernate.cfg.xml"
revengfile="hibernate.reveng.xml"/>
<property key="jdk5" value="false"/>
<property key="ejb3" value="false"/>
<hbm2hbmxml destdir="../configuration/Hibernate"/>
<!--hbm2dao destdir="${src.dir}/com/blah/persistence/dataaccess/gen"/--><!-- this works -->
<hbmtemplate destdir="${src.dir}/com/blah/persistence/dataaccess/gen" templateprefix="dao/" template="templates/dao/daohome.vm" filepattern="{package-name}/{class-name}Home.java"/><!-- This does not work -->
<hbmtemplate destdir="${src.dir}/com/blah/persistence/dto" templateprefix="pojo/" template="templates/pojo/Pojo.vm" filepattern="{package-name}/{class-name}.java"/>
<hbmtemplate destdir="${src.dir}/com/blah/persistence/datainterface" templateprefix="pojo/" template="templates/pojo/PojoInterface.vm" filepattern="{package-name}/{class-name}I.java"/>
</hibernatetool>
Look at
http://forum.hibernate.org/viewtopic.ph ... ht=daohome (same issue?)
http://opensource2.atlassian.com/projec ... se/HBX-601 (ok, i was too quick with this, sorry)
Do we have a bug or i'm i missing something?