Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error with XDoclet In Hibernate  RSS feed

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I am getting error while i am generating .hbm.xml files using XDoclet.

This is the error i am getting

D:\suneel\databasework\LoginApp\WEB-INF\build.xml:41: Couldn't find the class xdoclet.modules.web.WebDocletTask on the classpath:

My build.xml file is

<project name="loginapp" basedir="." default="main">

<property name="src.dir" value="src"/>
<property name="springconf.files" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="lib.dir" value="lib/xdoclet"/>
<property name="generated.home" value="generated.home"/>

<target name="compile" description="Generates class files">
<echo message="builiding classes"/>
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>

<target name="generate"
description="Generates Hibernate class descriptor files."
<echo message="Generates Hibernate class descriptor files."/>
<!-- Define the hibernatedoclet task -->
<taskdef name="hibernatedoclet"


<fileset dir="${lib.dir}/">
<include name="*.jar"/>
<echo message="after Generates Hibernate class descriptor files."/>
<!-- Execute the hibernatedoclet task -->
<echo message="Generates Hibernate doclet."/>
<fileset dir="${src.dir}">
<include name="**/com/itc/example/business/*.java"/>

<hibernate version="3.1"/>

<!-- Upgrade grammar from Hibernate1 to Hibernate2 - not needed if you are using the <hibernate version="2.0"/> tag -->
<replace dir="${generated.home}" echo="building xml">

<include name="**/hibernate/*.hbm.xml"/>
<replacefilter token="readonly=" value="inverse="/>
<replacefilter token="role=" value="name="/>
<replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
<target name="file-list"
description="Create hibernate mapping file list">
<property name="generated.dir" location="target/classes"/>
<property name="hibernate.list.file" location="hbnfiles.xml"/>
<script language="beanshell" src="create_hbnfiles.bsh"/>
<path id="classpath">
<fileset dir="${lib.dir}/" includes="**/*.jar"/>
<path location="${springconf.files}"/>

<target name="clean">
<delete dir="${build.dir}"/>
<target name="main" depends="generate"/>

Can anybody help me to solve this problem..

Advance thanks to all

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it a ant problem your classpath is wrong


but be sure that xdoclet file are well placed there
<property name="lib.dir" value="${base}/lib/xdoclet"/>
[ July 07, 2006: Message edited by: Benjamin Leonard ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!