jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Turley <syn...@synath.com>
Subject Re: More problems: Error finding class ...
Date Mon, 29 Aug 2005 20:05:39 GMT
Hi Kenney,

You said that if I'm running the classes straight from Eclipse (which I 
am) I could add WEB-INF/classes as a src directory.  I have the test 
source directories added as source directories with the correct output 
folders.  Here are the lines from my .classpath file:

    <classpathentry excluding="**/CVS/" kind="src" path="src"/>
    <classpathentry excluding="**/CVS/" 
output="web/WEB-INF/test-classes/cactus-classes" kind="src" 
    <classpathentry excluding="**/CVS/" 
output="web/WEB-INF/test-classes/junit-classes" kind="src" 

Is that sort of what you meant?  Should that work?  It doesn't, 
unfortunately.  If you can't see anything wrong with that, I'll just 
have Eclipse output my test classes into WEB-INF/classes...  I'd rather 
not.  Maybe I'm just stubborn.  When I think something SHOULD work, I 
want it to :-).

Kenney Westerhof wrote:

>On Mon, 29 Aug 2005, David Turley wrote:
>Hi David,
>If you deploy that war, the classes NEED to be in WEB-INF/classes.
>You could also jar them up and put them in WEB-INF/lib/.
>Those are the only two places classes should be placed in web
>If you run those classes directly from eclipse, you could add
>WEB-INF/test-classes as a source folder (or, if you have a separate source
>folder for the test-classes sources, modify .classpath and specify
>an output=".../WEB-INF/test-classes" to the correct line; can't edit them
>from within eclipse).
>But, in the war, they really NEED to be in the classpath or else the
>Webapp classloader won't find them! And it really doesn't matter where
>your classes are, as long as your sources are nicely organized.
>	Kenney
>>Hello again,
>>    Yes, I'm still having problems, and most of them have nothing to do
>>with computers.  But this one does.  When I first started playing with
>>Cactus, I was just running things from Eclipse and the JUnit test
>>runner, but then I wanted to automate things, so I spent a lot of time
>>working with Ant.  At first I had put my test classes in the same
>>directories as the classes they were testing, but I decided that was
>>messy and decided to make separate src and class directories for the
>>test classes.  That works great with ant because you could have your
>>test classes on mars as long as you could tell ant where to find them.
>>Not so with the JUnit integration in Eclipse.  It cannot find my test
>>classes.  It worked fine when they were going to the WEB-INF/classes
>>directory, but now they're in WEB-INF/test-classes and I get the
>>following when I try to run tests:
>>javax.servlet.ServletException: Error finding class
>>using both the Context classloader and the webapp classloader. Possible
>>causes include:
>>    - Your webapp does not include your test classes,
>>    - The cactus.jar is not located in your WEB-INF/lib directory and
>>your Container has not set the Context classloader to point to the
>>webapp one
>>followed by the rest of the stack trace.  Well, the cactus.jar is in the
>>correct place.  That's about all I know.  I don't know much (anything)
>>about classloaders, so maybe that's my problem.  Maybe it's just another
>>I.D.10T. error.  :-)  I'm learning....
>>To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>Kenney Westerhof
>GPG public key: http://www.gods.nl/~forge/kenneyw.key
>To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-user-help@jakarta.apache.org

View raw message