-->
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: NoClassDefFoundError: org/hibernate/cfg/Configuration-SOLVED
PostPosted: Fri Jul 15, 2005 12:11 pm 
Newbie

Joined: Fri Jul 15, 2005 11:54 am
Posts: 1
SOLVED
Great. After I type all this in, I was trying out some other stuff, and found the following.

I have the hibernate-tools.jar in the ant/lib directory.

If I remove that hibernate-tools.jar and add it to the hibernate.cp below, things work right.

Sheesh. I guess that's just my lack of understanding of how ant classloaders work.

Anyways, I figured I would go ahead and post it in case somebody else had this problem.


Summary: When using the hibernatetool ant task, NoClassDefFoundError: org/hibernate/cfg/Configuration exception thrown unless hibernate3.jar is in system level classpath.

Hibernate version: hibernate-3.1 alpha 1, hibernate-tools 3.0 alpha 4a

build.xml
<project name="testBuild" default="testTool" basedir=".">

<path id="hibernate.cp">
<pathelement location="hibernate3.jar"/>
</path>

<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernate.cp"
/>

<target name="testTool">
<hibernatetool destdir=".">
<annotationconfiguration/>
<hbm2ddl outputfilename="hbm2ddl.sql"/>
</hibernatetool>
</target>

</project>

Description
I realize that the build is not complete, I was just putting a simple build in to try to narrow down my problem. The build, as shown, throws the Exception mentioned. I have tried changing the taskdef to have a classpath instead of classpathref, and a few other variations of that, to no avail. The only thing that gets me to my next missing jar (LogFactory) is to
export CLASSPATH=hibernate3.jar
from the command line before executing the ant testTool. Also, if I put hibernate3.jar

Full output follows:
> ant -debug -f testbuild.xml
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: testbuild.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: /opt/devel/jdk1.5.0_02/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.version -> Apache Ant version 1.6.5 compiled on June 2 2005
Setting ro project property: ant.file -> /opt/cvs/build/testbuild.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /opt/cvs/build/testbuild.xml with URI = file:///opt/cvs/build/testbuild.xml
Setting ro project property: ant.project.name -> testBuild
Adding reference: testBuild
Setting ro project property: ant.file.testBuild -> /opt/cvs/build/testbuild.xml
Project base dir set to: /opt/cvs/build
+Target:
Adding reference: hibernate.cp
+Target: testTool
Could not load a dependent class (com/sun/media/jai/codec/FileSeekableStream) for type image
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type sshexec
Could not load a dependent class (com/jcraft/jsch/UserInfo) for type scp
Adding reference: hibernate.cp
Class org.hibernate.tool.ant.HibernateToolTask loaded from parent loader (parentFirst)
+Datatype hibernatetool org.hibernate.tool.ant.HibernateToolTask
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `testTool' is [testTool]
Complete build sequence is [testTool, ]

testTool:

BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
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: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.privateGetPublicMethods(Class.java:2488)
at java.lang.Class.getMethods(Class.java:1406)
at org.apache.tools.ant.IntrospectionHelper.<init>(IntrospectionHelper.java:171)
at org.apache.tools.ant.IntrospectionHelper.getHelper(IntrospectionHelper.java:315)
at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:318)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:182)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
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)
... 7 more
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.privateGetPublicMethods(Class.java:2488)
at java.lang.Class.getMethods(Class.java:1406)
at org.apache.tools.ant.IntrospectionHelper.<init>(IntrospectionHelper.java:171)
at org.apache.tools.ant.IntrospectionHelper.getHelper(IntrospectionHelper.java:315)
at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:318)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:182)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
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)


Top
 Profile  
 
 Post subject: Re: NoClassDefFoundError: org/hibernate/cfg/Configuration-SOLVED
PostPosted: Sun Aug 16, 2009 7:26 pm 
Newbie

Joined: Sun Aug 16, 2009 6:01 pm
Posts: 1
Thank you. It really helped me.


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.