jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: Can't find classes in pkgs outside WEB-INF/classes
Date Wed, 08 Jan 2003 23:02:52 GMT
Mark wrote:
> I have a server-side class loading problem, but not able to figure out 
> why. Using Cactus I can run tests and access servlets just fine if the 
> classes are all located under WEB-INF/classes directory, but I get 
> NoClassDefFoundError if I try to access classes in a different package. 
> This is a working application so I'm obviously not understanding 
> something from the Cactus/classloader side of things.  I've read the 
> ClassPath HowTo and it only describes a WEB-INF/classes structure.  

Cactus should be able to load any classes that can be loaded by the 
web-application itself, because it's using the web-applications' class 
loader by default.

> Given this directory structure:
>       |
>    /classes
>          |
>        Servlet1.class
>        TestClass1.class
>        /pkg1
>            |
>           AppClass1.class
> I can run a test case where TestClass1 instantiates Servlet1, but if 
> Servlet1 tries to instantiate pkg1.AppClass1, it's not found.  This 
> seems like it should be something very simple but I'm at a loss.


[Note that you shouldn't really use the "default package" (i.e. no 
package, classes directly under WEB-INF/classes in this case), except 
maybe in examples.]

Can you provide some more details, like the container you're using, 
maybe some log output, stack traces etc.?

> Any help will be appreciated, and sorry for yet a newbie question that's 
> CLASSPATH related.

Classpath problems are quite frequent for "pros" to ;-)

Christopher Lenz
/=/ cmlenz at gmx.de

View raw message