| Author |
NoClassDefFoundError when accessing global classes
|
Alan Yap
Ranch Hand
Joined: Feb 24, 2006
Posts: 32
|
|
I've just installed Tomcat 5.5 into "c:\tomcat5.5" folder and been toying around with it the whole day. Tried migrating some of webapps that I did before (and ran quite well in Resin) over to Tomcat, but stumbled upon some errors. I suspect Tomcat might have failed to locate my class files. This prompts me to start from a clean slate to test it with a new webapp. I've created a webapp named "mytest", with the following files: C:\tomcat5.5\webapps\ROOT\WEB-INF\classes\testpack\testobject.class C:\tomcat5.5\webapps\ROOT\WEB-INF\classes\testpack\testobject.java c:\mytest\main.jsp (and its content below) The above throws a NoClassDefFoundError exception. When I moved "testpack\testobject.class" into "c:\mytest\WEB-INF\classes" folder, only then everything is solved. I have many packages that need to be shared among my webapps, so what is the problem that caused my Tomcat unable to detect them when I put them all inside "C:\tomcat5.5\webapps\ROOT\WEB-INF\classes" ? Below are the fragments from my CLASSPATH. Anything that I missed out in the configuration? .;C:\tomcat5.5\common\lib\servlet-api.jar;c:\tomcat5.5\common\lib\jsp-api.jar; [ September 11, 2008: Message edited by: Alan Yap ] [ September 11, 2008: Message edited by: Alan Yap ] [ September 11, 2008: Message edited by: Alan Yap ]
|
When I'm not coding.. I do THIS
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
|
|
Your Tomcat installation probably has a file named class-loader-howto.html under tomcat-docs. That file should clarify everything. Bill
|
Java Resources at www.wbrogden.com
|
 |
Alan Yap
Ranch Hand
Joined: Feb 24, 2006
Posts: 32
|
|
Thanks Bill! That howto file you suggested me to read enlightened me alot. My problem is all solved now. I've dunked my class files into "c:\tomcat55\common\classes" and it worked. Before I started this thread, I was advised by the link below to put all my shared classes into "c:\<tomcat folder>\webapps\ROOT\WEB-INF\classes" folder to conform to the "standard". Doesn't apply to my case though. http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-5.5.html#Test1
|
 |
 |
|
|
subject: NoClassDefFoundError when accessing global classes
|
|
|