It's not a secret anymore!
The moose likes Other Open Source Projects and the fly likes error when using xdoclet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "error when using xdoclet" Watch "error when using xdoclet" New topic
Author

error when using xdoclet

Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
When I try to use xdoclet to generate a web.xml file I receive the following error:
java.lang.NoClassDefFoundError: org/apache/log4j/Category
at xdoclet.util.Log.getCategory(Log.java:22)
at xdoclet.DocletTask.execute(DocletTask.java:228)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:166)
at org.apache.tools.ant.Task.perform(Task.java:319)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
at org.apache.tools.ant.Main.runBuild(Main.java:610)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)
org/apache/log4j/Category
My target appears as follows:

My properties are defined as follows:

Has anyone seen this issue and know how to resolve it? Thanks.


Matthew Phillips
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Try this:

[ February 24, 2003: Message edited by: Chris Mathews ]
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
That didn't work either. It seems to be finding the other jar files in the classpath. It is just not finding the log4j jar or at the very least that particular class. Thanks for the attempt.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I found a solution. For some reason it didn't like the fact that the log4j jar was not in ant/lib. When I copied it there and pointed my path element to that location it worked. It doesn't seem like the ideal solution, so if anyone see's anything else I am still open to suggestions.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Matthew Phillips:
I found a solution. For some reason it didn't like the fact that the log4j jar was not in ant/lib. When I copied it there and pointed my path element to that location it worked. It doesn't seem like the ideal solution, so if anyone see's anything else I am still open to suggestions.

That is actually what I was going to suggest next . Putting the jar in ant/lib has the effect of putting it on Ant's Classpath. That is not ideal but it gets the job done...
Maybe there is something about Ant and taskdefs that I am missing but I think what you had before should have worked.
[ February 25, 2003: Message edited by: Chris Mathews ]
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I have discovered that xdoclet will not look anywhere on the classpath that is not in ant/lib. I had it running, but it would not add the servlet element to web.xml until I copied j2ee.jar to ant/lib. I am using 1.1.2. I am going to try the beta release of 1.2.0 and see if it is any different. I'll keep you posted on my results.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Upon further review, it appears that this is the correct way of doing things. I was looking over the samples and some readme files (I know, I should RTFM before posting) and it appears that the required jars need to be copied into the same directory as the xdoclet.jar file.
[ February 25, 2003: Message edited by: Matthew Phillips ]
Fady Matar
Greenhorn

Joined: Aug 13, 2003
Posts: 12
Hey there,
Do not place anything in the ant installation lib folder
You don't even need to define a classpath to get your job done.
The ideal way in using ant is the following
define your own path ant point it to the location of the class or jar files you want to include. This is an exempt of my build.xml
<property name="xdoclet.lib" value="/opt/java/xdoclet/lib" />
<property name="project.lib" value="${basedir}/lib" />
<path id="classpath">
<!-- include xdoclet jar files -->
<fileset dir="${xdoclet.lib}">
<include name="*.jar" />
</fileset>
<!-- any jar files included in the lib directory
are automatically appended to the classpath -->
<fileset dir="${project.lib.dir}">
<include name="*.jar" />
</fileset>
</path>


Reasonable men adapt themselves to the world.<br />Unreasonable men adapt the world to themselves.<br />That's why all progress depends on unreasonable men.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: error when using xdoclet
 
Similar Threads
getting an error while executing this task
SAXParseException: The content of element type "enterprise-beans" is incomplete, it m
Speed EJB component development with XDoclet
Juint task in Ant
SAXParseException: The content of element type "enterprise-beans" is incomplete, it m