NoClassDefFoundError when accessing global classes
Joined: Feb 24, 2006
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?
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.