wood burning stoves*
The moose likes Servlets and the fly likes Tomcat NoClassDefFoundError resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat NoClassDefFoundError resolved" Watch "Tomcat NoClassDefFoundError resolved" New topic
Author

Tomcat NoClassDefFoundError resolved

mlweber
Greenhorn

Joined: Jun 26, 2002
Posts: 2
I'm using Tomcat 4.04 on Win2k and was getting a java.lang.NoClassDefFound error when I try to include and reference classes I created myself that are in the local classpath. This machine is my development workstation, and I really wanted to be able to modify, recompile, and test the classes where they reside without making JARs or moving the classes out of my standard development classpath that is used by servlets and non-servlets.
I searched this newsgroup and found others with the same problem, but no solution that didn't require moving the classes.
My solution is to edit c:\tomcat\bin\setclasspath.bat to include the path of my standard libraries' root. Simple, obvious and effective. Maybe this will help someone else...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
My solution is to use ANT and define a "copy to Tomcat" task. That way if my development classes get really bollixed, Tomcat still works.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61309
    
  66

I do the same as William. I think it's a bit of a dangerous idea to set the classpath to point all over the place.
Also I'd much rather that my development environment match the production environment as much as possible. Makes for a lot fewer gotchas at deployment time.
Just my way,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mlweber
Greenhorn

Joined: Jun 26, 2002
Posts: 2
Thanks for the feedback. I should point out that I am still learning Java (got to escape the clutches of Microsoft at some point), and none of my code goes into production at this point. For more effective learning, I'm taking quick shortcuts that I agree would not be appropriate in a "real" setting. I'm also just getting into Ant and will implement your suggestion when I get a chance.
Thanks again.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
ANT has a steep learning curve but I'll never go back! I use UltraEdit-32 which lets me define projects and project specific Ant tasks.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
mlweber,
Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.
Thanks,
Cindy


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
GeeCON Prague 2014
 
subject: Tomcat NoClassDefFoundError resolved