-->
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.  [ 1 post ] 
Author Message
 Post subject: NoClassDefFoundError if building DDL
PostPosted: Thu Feb 28, 2013 11:07 am 
Newbie

Joined: Wed Mar 28, 2012 8:31 pm
Posts: 9
Hi,
I'm new to hibernate so I'm unclear about how to diagnose error messages. This is my first attempt of
a hibernate example. I've received the following message if running 'ant exportDDL'. I'm not sure how to begin to fix it. I've also included part of 'build.xml'.

thanks,
matias.
------------------------------------------------------------------------------------------------------------------------------------------------------
Code:
ant exportDDL
Buildfile: /home/matias/hibernate/Bh3 2nd Ed Source Code/Chapter03/build.xml

compile:
    [javac] /home/matias/hibernate/Bh3 2nd Ed Source Code/Chapter03/build.xml:48: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

exportDDL:
   [htools] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
   [htools] 1. task: hbm2ddl (Generates database schema)

BUILD FAILED
/home/matias/hibernate/Bh3 2nd Ed Source Code/Chapter03/build.xml:38: java.lang.NoClassDefFoundError: org/hibernate/service/spi/SessionFactoryServiceRegistry
   at org.hibernate.tool.ant.Hbm2DDLExporterTask.createExporter(Hbm2DDLExporterTask.java:51)
   at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
   at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
   at org.apache.tools.ant.Task.perform(Task.java:348)
   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.service.spi.SessionFactoryServiceRegistry
   at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1361)
   at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1311)
   at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
   ... 20 more

Total time: 0 seconds


---------------------------------------------------------------------------------------------------------------------------------------------------------
from build.xml
Code:
. . .

   <taskdef name="htools"
      classname="org.hibernate.tool.ant.HibernateToolTask"
      classpathref="classpath.tools"/>

   <target name="exportDDL" depends="compile">
      <mkdir dir="${sql}"/>
      <htools destdir="${sql}">
         <classpath refid="classpath.tools"/>
         <annotationconfiguration
            configurationfile="${src}/hibernate.cfg.xml"/>
         <hbm2ddl drop="true" outputfilename="sample.sql"/>
      </htools>
   </target>

   <target name="compile">
      <mkdir dir="${bin}"/>
      <javac srcdir="${src}" destdir="${bin}" classpathref="classpath.base"/>
   </target>
   <target name="populateMessages" depends="compile">
      <java classname="sample.PopulateMessages" classpathref="classpath.tools"/>
   </target>

   <target name="listMessages" depends="compile">
      <java classname="sample.ListMessages" classpathref="classpath.base"/>
   </target>

. . .


------------------------------------------------------------------------------------------------------------------------------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.