I have read on this list and in docs if
your servlet class is part of a package,
say com.foo.foobar...that
if you put it in a directory called
$TOMCAT_HOME/webapps/myapp/WEB-INF/classes/com/foo/foobar
assuming the source file has the statement
package com.foo.foobar;
it will be picked up by the class loader and will work.
I have tried this just that way and had this result:
- Ctx( /foo ): Exception in: R( /foo + /servlet/foo + null)
- java.lang.NoClassDefFoundError: foo (wrong name: com/bar/foobar/foo)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
[remainder of stack dump snipped]
----------------------------------------------------------------------------
--------------------------------------
Yet if I remove the package declaration and put the file
in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes,
it works.
All defaults are being used as far as the configuration files (ie. for this
example I only added the directory under myapps and added nothing
to tomcat.con or server.xml).
What am I missing? What is the correct way to add a servlet
that has a package declaration?
Thanks,
Mark