Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:35:36+00:00 2026-06-04T23:35:36+00:00

I would like to generate SQL DDL scripts from Hibernate/JPA Annotation Classes using ANT.

  • 0

I would like to generate SQL DDL scripts from Hibernate/JPA Annotation Classes using ANT.

Below is the ANT script that I wrote based on Hibernate Dev Docs URL: http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html_single/

   <project name="yourmarketnet" default="all" basedir=".">
<target name="ddl_generation">
<!-- paths to required jars  -->
<path location="web/WEB-INF/lib/hibernate-annotations.jar" />
<path location="web/WEB-INF/lib/ejb3-persistence.jar" />
<path location="web/WEB-INF/lib/hibernate-entitymanager.jar" />
<path location="web/WEB-INF/lib/javaassist.jar" />
<path location="web/WEB-INF/lib/hibernate-tools.jar"/>
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask.jar">
     <classpath path="${build.dir}/web/WEB-INF/lib/hibernate-tools.jar"/> 
    </taskdef>
<!-- output destination -->
<hibernatetool destdir="${build.dir}">
    <!-- were the annotation beans files are located-->
<classpath>
<path location="${build.dir}/web/WEB-INF/classes/com/yourmarketnet/beans" />
</classpath>
<!-- list exporters here -->
<hbm2ddl
export="false"
update="false"
drop="true"
create="true"
outputfilename="myApps.ddl"
delimiter=";"
format="false"
haltonerror="true"/>
</hibernatetool>
</target>
</project>

Im getting ERROR taskdef class org.hibernate.tool.ant.HibernateToolTask cannot be found
using the classloader AntClassLoader[]

I also checked to see if hibernate-tools.jar was actually in the path and it was (C:\Users\naim\Documents\NetBeansProjects\yourmarketnet\build\web\WEB-INF\lib\hibernate-tools.jar)

Can someone please tell me step by step how to fix/debug this issue , thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:35:38+00:00Added an answer on June 4, 2026 at 11:35 pm

    Error message clearly tells you that ant can’t find your tools. When you declare

    <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" >
       <classpath path="${build.dir}/web/WEB-INF/lib"/>
    </taskdef>
    

    it’s already wrong because tool classes are not in directory but in jar. Secondly, your intent seems to be to use ${build.dir} as output location, so why would it contain tool classes? Anyway, you didn’t even define this directory.

    So if you really have your hibernate-tools.jar in web/WEB-INF/lib, you probably want something like

    <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" >
       <classpath path="web/WEB-INF/lib/hibernate-tools.jar"/>
    </taskdef>
    

    Note that it’s relative to your project directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using linq to sql I would like to generate some sealed classes in a
I would like to automate script generation (in SSMS --> Tasks --> Generate Scripts)
I would like to generate the mysql-password hash from js. I know the method
I am creating a function that I would like to generate random strings from
I have a simple model from simulink and I would like to generate code
I would like to generate a Data Dictionary for a SQL Server 2008 database
With SQL Server Reporting Services I would like to generate a report with line
I have designed some classes using Visual Studio class diagramming. Now I would like
I would like to generate diff-like SQL files to compare the DATA and the
I am using Fluent-NHibernate (with automapping) to generate my tables but would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.