-->
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: Error while running HibernateToolTask
PostPosted: Wed Nov 09, 2005 11:26 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 3:18 am
Posts: 32
Hi,
I tried to use HibernateToolTask to write the schema update script to an external file but I got some errors.

Note: I'm using annotations.

Here is the ant task I wrote:

Code:
<path id="hibernateTool.classpath">
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate3.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate-tools*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="mysql-connector-java*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="velocity*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="jtidy*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="commons*.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="hibernate-annotations.jar"/>
      <fileset dir="${tomcat.home}/webapps/4s/WEB-INF/lib" includes="dom4j*.jar"/>
   </path>
         
   <target name="hibernatetool">
       <taskdef name="hibernatetool"
              classname="org.hibernate.tool.ant.HibernateToolTask"
              classpathref="hibernateTool.classpath"/>
         
      <hibernatetool destdir="${tomcat.home}/webapps/4s/ant">
          <classpath> <!-- a classpath is optional, but needed for exporters that require access to domain classes etc. -->
             <path location="${tomcat.home}/webapps/4s/src/"/>
            </classpath>
         <annotationconfiguration configurationfile="dfdf.cfg.xml">
            <fileset dir="${tomcat.home}/webapps/4s/src/" id="id">
                  <include name="**/*.java"/>
                </fileset>
         </annotationconfiguration>
         <hbm2ddl update="true"
              outputfilename="schema.sql"
              delimiter = ";"/>
      </hibernatetool>
   </target>



Here is the error I get:


Code:
/home/smagied/dev/eclipse/production/4s/ant/ant.xml:76: Problems in creating a AnnotationConfiguration. Have you remembered to add it to the classpath ?
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:30)
   at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
   at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:180)
   at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:35)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java: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(DefaultExecutor.java:40)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:416)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.lang.NoSuchMethodError: org.hibernate.util.ReflectHelper.classForName(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:26)
   ... 14 more
--- Nested Exception ---
java.lang.NoSuchMethodError: org.hibernate.util.ReflectHelper.classForName(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Class;
   at org.hibernate.tool.ant.AnnotationConfigurationTask.createConfiguration(AnnotationConfigurationTask.java:26)
   at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
   at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:180)
   at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:35)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java: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(DefaultExecutor.java:40)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:416)
   at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:138)



I would like to know, from where could I download the source code of hibernate-tools.jar as it's not included in the jar and I couldn't find it on CVS.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 11:32 am 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
The source for the ant tasks and all the other tools are in the HibernateExt module in CVS.


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.