You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ken Ramirez <kr...@mastermind.com> on 2002/02/27 06:11:27 UTC
ClassNotFoundException
Hope someone can help:
I have a TOMCAT app containing a servlet as follows:
<TOMCAT_HOME>/webapps/MyApp/WEB-INF/classes/com/mycomp/MyServletClass.cl
ass
This class extends a base class that provides common functionality for
all of my apps, and is stored in:
<TOMCAT_HOME>/common/classes/com/mycomp/MyBaseServletClass.class (which
extends HttpServlet)
Through some context information, the MyBaseServletClass receives the
classname of a class stored in my app's classes directory,
which it is responsible for creating an instance of, using
Class.forName(). This is the path of the class to be created:
<TOMCAT_HOME>/webapps/MyApp/WEB-INF/classes/com/mycomp/MyOtherClass.clas
s
When the MyServletClass calls Class.forName, it fails with a
ClassNotFoundException, but if I move the MyServletClass
to the MyApp/WEB-INF/classes path, everything works fine.
What gives? I thought that Tomcat reads adds the classes directory for
all of the apps deployed in the server.xml
(with Context info), which I defined as follows:
<Context path="/MyApp" docBase="MyApp" debug="0" reloadable="true" />
Thanks,
Ken Ramirez - Principal/CTO
kramirez@mastermind.com
Master-Mind Consulting Services
http://www.mastermind.com <http://www.mastermind.com/>
Ph - 570-688-9600
Fx - 208-275-2301