1 Reply Latest reply: May 5, 2008 9:35 PM by 807581 RSS

    hbm2java(hibernate-tool)

    807581
      Hi,

      I'm trying to use hibernate-tool hbm2java.
      I create myht folder, inside this I put build.xml which is:

      <?xml version="1.0"?>
      <project name="hibernate-tutorial" default="compile">
      
      <property  name="base" value="."/>    
      <property name="hibernateConfigdir" value="${base}/config"/>
      <property name="hibernateSourcedir" value="${base}/hibernate-src"/>
      <property name="generatedSourcedir" value="${base}/src"/>
      <property name="librarydir" value="${base}/lib"/>    
      
      <path id="toolslib">
      
       <path location="${librarydir}/hibernate-tools.jar" />
       <path location="${librarydir}/hibernate3.jar" />
       <path location="${librarydir}/freemarker.jar" />
       <path location="${librarydir}/commons-logging-1.0.4.jar" />
       <path location="${librarydir}/dom4j-1.6.1.jar" />
       <path location="${librarydir}/commons-collections-2.1.1.jar" /> 
       <path location="${librarydir}/hsqldb.jar" />
       <path location="${librarydir}/jtidy-r8-20060801.jar" /> 
      <path location="${librarydir}/DharmaDriver.jar" />
      
      </path>   
      
      <taskdef name="hibernatetool" 
      
      classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
      
      <target name="hbm2java">   
      
      <hibernatetool destdir="${generatedSourcedir}">        
      <classpath>
                  <path location="${generatedSourcedir}/classes"/>
                </classpath>
                
                <configuration configurationfile="${hibernateConfigdir}/hibernate.cfg.xml">   
      
                    
                  <fileset dir="${hibernateSourcedir}/events">
                    <include name="**/*.hbm.xml"/>
                  </fileset>
                </configuration>
                
                <hbm2java/>
                
              </hibernatetool>
          </target>  
          
      
      </project>
      I include all jar in my lib folder.

      When I try on command line
      as: ant hbm2java
      It should give me java file but
      I found some problem

      Microsoft Windows XP [Version 5.1.2600]
      (C) Copyright 1985-2001 Microsoft Corp.
      
      C:\Documents and Settings\shobhitsingh>f:
      
      F:\>cd myht
      
      F:\myht>ant hbm2java
      Buildfile: build.xml
      
      hbm2java:
      [hibernatetool] Executing Hibernate Tool with a Standard Configuration
      [hibernatetool] 1. task: hbm2java (Generates a set of .java files)
      [hibernatetool] Dec 13, 2001 1:22:06 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: Hibernate 3.2.3
      [hibernatetool] Dec 13, 2001 1:22:06 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: hibernate.properties not found
      [hibernatetool] Dec 13, 2001 1:22:06 AM org.hibernate.cfg.Environment buildBytec
      odeProvider
      [hibernatetool] INFO: Bytecode provider name : cglib
      [hibernatetool] Dec 13, 2001 1:22:06 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
      [hibernatetool] Dec 13, 2001 1:22:07 AM org.hibernate.cfg.Configuration configur
      e
      [hibernatetool] INFO: configuring from file: hibernate.cfg.xml
      [hibernatetool] Dec 13, 2001 1:22:07 AM org.hibernate.cfg.Configuration doConfig
      ure
      [hibernatetool] INFO: Configured SessionFactory: null
      [hibernatetool] Dec 13, 2001 1:22:07 AM org.hibernate.cfg.Configuration addFile
      [hibernatetool] INFO: Reading mappings from file: F:\myht\hibernate-src\events\E
      vent.hbm.xml
      [hibernatetool] Dec 13, 2001 1:22:08 AM org.hibernate.cfg.HbmBinder bindRootPers
      istentClassCommonValues
      [hibernatetool] INFO: Mapping class: events.Event -> EVENTS
      [hibernatetool] Dec 13, 2001 1:22:08 AM org.hibernate.cfg.Configuration addFile
      [hibernatetool] INFO: Reading mappings from file: F:\myht\hibernate-src\events\P
      erson.hbm.xml
      [hibernatetool] Dec 13, 2001 1:22:08 AM org.hibernate.cfg.HbmBinder bindRootPers
      istentClassCommonValues
      [hibernatetool] INFO: Mapping class: events.Person -> PERSON
      
      BUILD FAILED
      F:\myht\build.xml:27: java.lang.NoClassDefFoundError: org/apache/velocity/except
      ion/MethodInvocationException
      
      Total time: 4 seconds
      F:\myht>ant hbm2java
      Buildfile: build.xml
      
      hbm2java:
      [hibernatetool] Executing Hibernate Tool with a Standard Configuration
      [hibernatetool] 1. task: hbm2java (Generates a set of .java files)
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: Hibernate 3.2.3
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: hibernate.properties not found
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Environment buildBytec
      odeProvider
      [hibernatetool] INFO: Bytecode provider name : cglib
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Environment <clinit>
      [hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Configuration configur
      e
      [hibernatetool] INFO: configuring from file: hibernate.cfg.xml
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Configuration doConfig
      ure
      [hibernatetool] INFO: Configured SessionFactory: null
      [hibernatetool] Dec 13, 2001 1:25:29 AM org.hibernate.cfg.Configuration addFile
      [hibernatetool] INFO: Reading mappings from file: F:\myht\hibernate-src\events\E
      vent.hbm.xml
      [hibernatetool] Dec 13, 2001 1:25:30 AM org.hibernate.cfg.HbmBinder bindRootPers
      istentClassCommonValues
      [hibernatetool] INFO: Mapping class: events.Event -> EVENTS
      [hibernatetool] Dec 13, 2001 1:25:30 AM org.hibernate.cfg.Configuration addFile
      [hibernatetool] INFO: Reading mappings from file: F:\myht\hibernate-src\events\P
      erson.hbm.xml
      [hibernatetool] Dec 13, 2001 1:25:30 AM org.hibernate.cfg.HbmBinder bindRootPers
      istentClassCommonValues
      [hibernatetool] INFO: Mapping class: events.Person -> PERSON
      
      BUILD FAILED
      F:\myht\build.xml:28: java.lang.NoClassDefFoundError: org/apache/velocity/except
      ion/MethodInvocationException
      
      Total time: 2 seconds
      F:\myht>
      Please anybody guide me to recover my problem.

      Thanks
      Regards
      -shobhit