-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Ant Error while processing template hbm/many-to-one.hbm.vm
PostPosted: Mon Sep 19, 2005 6:37 am 
Newbie

Joined: Thu Sep 08, 2005 2:14 pm
Posts: 7
Hibernate version:
3.1 beta1
hibernate-tools 3.1 alpha5

I have tried to generate mapping files from my annotated classes, to use the eclipse-plugin.

ant-task:
Code:
<target name="hibernatetool"
      description="generates hbm file">
      <taskdef
                 name="hibernatetool"
                 classname="org.hibernate.tool.ant.HibernateToolTask">
                 <classpath>
                    <fileset dir="${dir.lib}">
                       <include name="**/*.jar"/>
                    </fileset>
                    
                 </classpath>
      </taskdef>      
        <hibernatetool destdir="${dir.cfg}/hibernate/output">
           <classpath> <!-- a classpath is optional, but needed for generators that require access to domain classes etc. -->
               <fileset dir="${dir.lib}/hibernate">
                  <include name="**/*.jar"/>
                  <include name="**/*cfg.xml"/>
               </fileset>
              <fileset dir="${dir.cfg}/hibernate">
                 <include name="**/*cfg.xml"/>                 
              </fileset>
              <fileset dir="${dir.build}">
                 <include name="**/*.class"/>
              </fileset>
               <path location="${dir.build}"/>
              <path location="${dir.cfg}/hibernate"/>
            
           </classpath>      
           <annotationconfiguration configurationfile="./cfg/hibernate/hibernate.cfg.xml"/> <!-- annotated class/packages are specified in the hibernate.cfg.xml -->
                        <!--cfg2cfgXml/-->
           <cfg2hbm/>
        </hibernatetool>
      
   </target>



the build failed with the following error message:
"Error while processing template hbm/many-to-one.hbm.vm"


Code:

hibernatetool:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: cfg2hbm (Generates a set of hbm.xml files)
[hibernatetool] 19.09.2005 12:31:50 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.1 beta 1
[hibernatetool] 19.09.2005 12:31:50 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 19.09.2005 12:31:50 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using CGLIB reflection optimizer
[hibernatetool] 19.09.2005 12:31:50 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 19.09.2005 12:31:50 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: AnnotationConfiguration
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing extends queue
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing collection mappings
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.annotations.CollectionBinder bindCollectionSecondPass
[hibernatetool] INFO: Mapping collection: de.pds.cust.ent.CustomerImpl.phoneNums -> pds_cust_phonenum
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.annotations.CollectionBinder bindCollectionSecondPass
[hibernatetool] INFO: Mapping collection: de.pds.cust.ent.AreaCodeImpl.phoneNums -> pds_cust_phonenum
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.annotations.CollectionBinder bindCollectionSecondPass
[hibernatetool] INFO: Mapping collection: de.pds.cust.ent.StreetImpl.streetParts -> pds_cust_streetpart
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.annotations.CollectionBinder bindCollectionSecondPass
[hibernatetool] INFO: Mapping collection: de.pds.cust.ent.CityImpl.cityDistricts -> pds_cust_citydistr
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing association property references
[hibernatetool] 19.09.2005 12:31:51 org.hibernate.cfg.Configuration secondPassCompile
[hibernatetool] INFO: processing foreign key constraints
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: **************************************************************
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Starting Jakarta Velocity v1.4
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: RuntimeInstance initializing.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Trying to use logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Using logger class org.apache.velocity.tools.generic.log.CommonsLogLogSystem
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.FileResourceLoader
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: FileResourceLoader : initialization starting.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: FileResourceLoader : adding path '.'
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: FileResourceLoader : initialization complete.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Resource Loader Instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ClasspathResourceLoader : initialization starting.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ClasspathResourceLoader : initialization complete.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Default ResourceManager initialization complete.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Loaded System Directive: org.apache.velocity.runtime.directive.Include
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Created: 20 parsers.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : initialization starting.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : allowInline = true : VMs can be defined inline in templates
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : allowInlineLocal = false : VMs defined inline will be  global in scope if allowed.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : messages on  : VM system will output logging messages
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : autoload off  : VM system will not automatically reload global library macros
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocimacro : initialization complete.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: Velocity successfully started.
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/hibernate-mapping.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:51 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/persistentclass.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/id.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/pkcolumn.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/property.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/column.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/property.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/column.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] INFO: ResourceManager : found hbm/many-to-one.hbm.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
[hibernatetool] 19.09.2005 12:31:52 org.apache.velocity.tools.generic.log.CommonsLogLogSystem logVelocityMessage
[hibernatetool] SCHWERWIEGEND: Method getJavaTypeName threw exception for reference $c2j in template hbm/many-to-one.hbm.vm at  [3,20]

BUILD FAILED
C:\Nils-Daten\Entwicklung\Diplom\build.xml:75: org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/many-to-one.hbm.vm

Total time: 2 seconds


Could anyone tell me, if this is caused by a bug or misconfiguration?
Is there a way to get a more verbose explanation what went wrong?
The debug mode did not give more information about the error.

Thanks in advance.

Nils

PS:
Stack-Trace with ant debug mode:
Code:
C:\Nils-Daten\Entwicklung\Diplom\build.xml:75: org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/many-to-one.hbm.vm
   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.executeTarget(Project.java:1214)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
   at org.apache.tools.ant.Main.runBuild(Main.java:673)
   at org.apache.tools.ant.Main.startAnt(Main.java:188)
   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/many-to-one.hbm.vm
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:94)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.startProperty(HibernateMappingExporter.java:114)
   at org.hibernate.tool.hbm2x.ConfigurationNavigator.export(ConfigurationNavigator.java:51)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.start(HibernateMappingExporter.java:183)
   at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   ... 8 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getJavaTypeName' in  class org.hibernate.tool.hbm2x.Cfg2JavaTool threw exception class java.lang.NullPointerException : null
   at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:246)
   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.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:82)
   ... 15 more
--- Nested Exception ---
org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/many-to-one.hbm.vm
   at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:94)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.startProperty(HibernateMappingExporter.java:114)
   at org.hibernate.tool.hbm2x.ConfigurationNavigator.export(ConfigurationNavigator.java:51)
   at org.hibernate.tool.hbm2x.HibernateMappingExporter.start(HibernateMappingExporter.java:183)
   at org.hibernate.tool.ant.GeneratorTask.execute(GeneratorTask.java:32)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:122)
   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.executeTarget(Project.java:1214)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
   at org.apache.tools.ant.Main.runBuild(Main.java:673)
   at org.apache.tools.ant.Main.startAnt(Main.java:188)
   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getJavaTypeName' in  class org.hibernate.tool.hbm2x.Cfg2JavaTool threw exception class java.lang.NullPointerException : null
   at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:246)
   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.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:82)
   ... 15 more



Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 9:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
probably a bug - we cfg2hbm is currently only built to handle what reverse engineering can output.

Coming from annotations to hbm.xml probably require more things to be added....feel free to submit a failing testcase and even better a patch for it ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.