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.  [ 4 posts ] 
Author Message
 Post subject: using Hibernate-Extension,Hbm2JavaTask -NoClassDefFoundError
PostPosted: Thu Aug 31, 2006 7:08 am 
Newbie

Joined: Sat Jun 24, 2006 6:26 pm
Posts: 10
Hello!

Following an example from the book 'Hibernate: A developers Notebook' from O'Reilly. Trying to generate a class from the Track.hbm.xml file but getting this error. Did copy the file 'hibernate-tools' to the location where I have all my jars from the hibernate download.
What am I missing ?


This is the error:
Code:
Caused by:
java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException
        at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
        at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:93)
        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.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)

        at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:149)
        at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:93)
        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.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)


this is my build.xml
Code:
<?xml version="1.0"?>
<project name="Harnessing Hibernate: The Developer's Notebook"
          default="db" basedir=".">
   <!-- Set up properties containing important project directories -->
   <property name="source.root" value="src"/>
   <property name="class.root" value="classes"/>
   <property name="lib.dir" value="lib"/>
   <property name="data.dir" value="data"/>

   <!-- Set up the class path for compilation and execution -->
   <path id="project.class.path">
      <!-- Include our own classes, of course -->
      <pathelement location="${class.root}"/>
      <!-- Include jars in the project library directory -->
      <fileset dir="${lib.dir}">
        <include name="**/*.jar"/>
      </fileset>
   </path>

      <target name="db" description="Runs HSQLDB database management UI    against the database file--use when application is not running">
         <java classname="org.hsqldb.util.DatabaseManager"
               fork="yes">
            <classpath refid="project.class.path"/>
            <arg value="-driver"/>
           <arg value="org.hsqldb.jdbcDriver"/>
            <arg value="-url"/>
           <arg value="jdbc:hsqldb:${data.dir}/music"/>
            <arg value="-user"/>
           <arg value="sa"/>
        </java>
    </target>
   <!-- Teach Ant how to use Hibernate's code generation tool -->
   <taskdef name="hbm2java"
            classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
             classpathref="project.class.path"/>

    <!-- Generate the java code for all mapping files in our source tree -->
    <target name="codegen"
            description="Generate Java source from the O/R mapping files">
        <hbm2java output="${source.root}">
          <fileset dir="${source.root}">
            <include name="**/*.hbm.xml"/>
          </fileset>
        </hbm2java>
    </target>
</project>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 01, 2006 3:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
don't use Hibernate 2 classes with Hibernate 3 tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Max, which class in the hibernate3 ...
PostPosted: Fri Sep 01, 2006 4:27 am 
Newbie

Joined: Sat Jun 24, 2006 6:26 pm
Posts: 10
should I use to convert the example within the book
to hibernate3, is it that hard to upgrade from version 2 to version 3?

best regards,i


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 01, 2006 4:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
read the hibernate migration guide on our wiki.

don't use hibernate 2 for new things.

_________________
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.  [ 4 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.