-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with Ant and HibernateToolTask
PostPosted: Mon Mar 05, 2012 1:22 pm 
Newbie

Joined: Wed Jun 17, 2009 3:35 pm
Posts: 3
I am getting a exception for the following simple ant file:
Code:
<project name="tool test" basedir=".">
   <import file="ant-scripts/properties.xml"/>

   <path id="rev-eng.classpath">
      <fileset dir="${src.libs.dir}">
         <include name="**/*.jar"/>
      </fileset>
      <pathelement location="${build.classes.dir}"/>
   </path>

   <taskdef
      name="hibernate-tool"
      classname="org.hibernate.tool.ant.HibernateToolTask"
      classpathref="rev-eng.classpath"/>

   <target name="test">
      <hibernate-tool destdir="${src.java.dir}" classpathref="rev-eng.classpath"/>
   </target>
</project>


The stack comes back as:
Code:
BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
   at java.lang.Class.getDeclaredMethods0(Native Method)
   at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
   at java.lang.Class.privateGetPublicMethods(Class.java:2547)
   at java.lang.Class.getMethods(Class.java:1410)
   at org.apache.tools.ant.IntrospectionHelper.<init>(IntrospectionHelper.java:180)
   at org.apache.tools.ant.IntrospectionHelper.getHelper(IntrospectionHelper.java:350)
   at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:376)
   at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:344)
   at org.apache.tools.ant.Task.maybeConfigure(Task.java:202)
   at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:196)
   at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
   at org.apache.tools.ant.Task.perform(Task.java:347)
   at org.apache.tools.ant.Target.execute(Target.java:390)
   at org.apache.tools.ant.Target.performTasks(Target.java:411)
   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
   at org.apache.tools.ant.Main.runBuild(Main.java:809)
   at org.apache.tools.ant.Main.startAnt(Main.java:217)
   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
   at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
   ... 22 more

Total time: 0 seconds


All the hibernate code was pulled from a maven repository using ivy.
I have checked the classpath referenced by rev-eng.classpath and it does contain hibernate-core.jar.
I can't find any other messages in the forum (or other forums) that address this problem.

Does anyone have any idea why this is happening?
Thanks.


Top
 Profile  
 
 Post subject: Re: Problem with Ant and HibernateToolTask
PostPosted: Tue Mar 06, 2012 11:28 am 
Newbie

Joined: Wed Jun 17, 2009 3:35 pm
Posts: 3
So, this is bizarre but I thought I would post the resolution.

In a nutshell, it turned out to be Ant. I was running 1.8.2 built on December 20 2010 and another developer was running 1.8.2 built on August 19 2011. His worked, mine didn't.

When I upgraded to 1.8.3 all the problems went away.


Top
 Profile  
 
 Post subject: Re: Problem with Ant and HibernateToolTask
PostPosted: Wed Jun 13, 2012 1:06 pm 
Newbie

Joined: Tue Sep 14, 2010 6:04 am
Posts: 5
It cost me almost one day!!!

Tips for anyone who encounters this error: try ant -debug

-> it shown me that my hibernate3.jar had zipException (it worked before, maybe it got corrupted sometime). Not about ant version.

Anyway, the error message doesn't help at all, it just confuses people!

Good look to everyone


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.