tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Newman" <sam.new...@stamplets.com>
Subject Re: packages under WEB-INF/classes
Date Mon, 16 Apr 2001 14:15:46 GMT
Does your entry in the web.xml for your context reference the servlet using
its full path? Also, double check the case of the packages - the entry
web.xml, the package declaration and the actual directory strucutre all have
to match.

sam
----- Original Message -----
From: "Mark" <mark101@telocity.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Monday, April 16, 2001 3:10 PM
Subject: packages under WEB-INF/classes


> 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
>
>


Mime
View raw message