This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

error when using xdoclet

 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

[ February 24, 2003: Message edited by: Chris Mathews ]
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Would you like to try a free sample? Today we are featuring tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!