-->
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: Problems with Ant SchemaExportTask
PostPosted: Tue Feb 08, 2005 10:43 pm 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
Hibernate version: 2.1.8


Ant Version: 1.6.2

I've been trying for a couple of days to get a SchemaExport to work, and no joy.

First, I tried using the command-line form, but the SchemaExport class uses getClass().getResourceAsStream(String) to read the configuration file and the mapping files, and for some reason I can't get it to see my configuration file even when I supply an absolute path (starting with a "/").

So then I tried with Ant, but Ant won't execute the SchemaExportTask task. It gives the following error...

Code:
C:\usr\Java\Projects\Collector>ant schemaexport
Buildfile: build.xml

BUILD FAILED
C:\usr\Java\Projects\Collector\build.xml:47: taskdef A class needed by class net.sf.hibernate.tool.hbm2ddl.SchemaExportTask cannot be found: org/apache/tools/ant/taskdefs/MatchingTask

The relevant portion of my build.xml looks like this...
Code:
  <target name="schemaexport">
    <taskdef name="schemaexport"
      classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
      classpathref="class.path"/>
    <schemaexport
      quiet="no"
      text="no"
      drop="no"
      delimiter=";"
      output="schema-export.sql">
      <fileset dir="model">
        include name="**/*.hbm.xml"/>
      </fileset>
    </schemaexport>
  </target>

As a test, I wrote a Java class which extends Ant's MatchingTask, and it worked just fine. Then I tried to load an instance of SchemaExportTask and received a NoClassDefFoundError.

My classpath is almost absurdly simple, and I can't find any conflicts. I''ve searched this forum for similar problems and confirmed that the conditions which caused them don't hold in this instance.

So I'm stumped. Any help, anybody?

TIA,
Luke[/code]
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 5:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm - haven't seen this error before....what is in the class.path variable you refer to ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 15, 2005 2:20 am 
Newbie

Joined: Sat Feb 05, 2005 8:11 am
Posts: 16
Location: Melbourne, Australia
Never mind - I finally figured out what was something missing from the class.path.

I had been trying to use Hibernate by including the relevant jar files in the JRE's lib/ext folder, but for some reason this seems to have been doomed to failure. Adding this...

<fileset dir="/tools/java/comp/hibernate">
<include name="**/*.jar"/>
</fileset>

...to my class.path fixed my problem.

Thanks for your reply,
Luke


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.