> -----Original Message-----
> From: Mike Sowka [mailto:[EMAIL PROTECTED]
> Sent: mercredi 23 mars 2005 22:12
> To: Cactus Users List
> Subject: RE: Losing Hair
> 
> Woohoo! :) Cela marche!
> 
> Yes, on one hand: in the first place I didn't have all of the cactus
> jars in the JBoss paths as I was afraid they would mess with the JBoss
> ones (httpclient), but #2 it was the three jars that I left in the JBoss
> directory (with duplicates in WEB-INF/lib) that were messing things up.
> 
> Keeping things clean, I don't put anything in CLASSPATH.
> 
> Vince, clue me in... how do You find such bugs, is it just one of those
> "hunches" given the stack trace?

Experience... :-)

To be honest this one is quite easy as it's a very common error. It has to
do with the fact that if you put the cactus JAR in the system CL or any
classloader higher in the hierarchy than the webapp classloader then when
Cactus tries to instantiate your test class it fails because your test class
is usually located in your WEB-INF/classes directory (thus in the webapp
classloader). That said, it still works in some containers because those
container sets the ContextClassLoader to be the webapp classloader and
Cactus tries to load the user class is both the current classloader and in
the context classloader too... ;-)

> I suppose if I placed _all_ (replacing ?old? JBoss ones) cactus jars at
> the JBoss scope it should work too (?). 

Nope, unless you also put your test classes there.

> Wouldn't replacing the older
> version of commons-httpclient break JBoss? 

I don't think so from the feedback I've had on the list.

> I now have to look into how
> to ant'ify the testing process; will look on the net as You suggested.

Check the Ant integration page and use the <cactus> Ant task. However,
before you ask :-), the <cactus> Ant task does not yet support JBoss 4.x
(only JBoss 3.x - Someone has provided a patch but that's a bit involved if
you want to apply it: http://issues.apache.org/jira/browse/CACTUS-152). That
said you can use either a <generic> container or use the <runservertests>
task. Check the doco online, it should get you started.
 
> Yes, the book is great, coming in very handy. I intend to use your
> PetStore version as my M.A.Sc of Eng. Thesis case-study :D

Hey, great!

-Vincent

> 
> Merci Beaucoup,
> Mike
> 
> On Wed, 2005-03-23 at 21:51 +0100, Vincent Massol wrote:
> > Hi Mike,
> >
> > > -----Original Message-----
> > > From: Mike Sowka [mailto:[EMAIL PROTECTED]
> > > Sent: mercredi 23 mars 2005 21:45
> > > To: Cactus Users List
> > > Subject: RE: Losing Hair
> > >
> > > Vincent,
> > >
> > > I tried the "Quickstart" app in order to trouble shoot Cactus+JBoss4,
> so
> > > yes I've already taken a good part of the week to familiarize myself
> > > with JUnit/Cactus with the help of your book (A BLESSING).
> >
> > Glad you liked it :-)
> >
> > >
> > > Using Tomcat is out of the question as I'm interested purely in
> testing
> > > EJBs, but at this point I'm considering switching backwards to
> > > JBoss3 :|.
> > >
> > > That's correct, I'm using ServletTestRunner to start the tests. I've
> > > compiled the Quickstart app with 1.3 servlet.jar, and... I've copied
> all
> > > of the cactus jars in the WEB-INF/libs (just to be on the "safe" side,
> > > but I doubt this is proper practise).
> > >
> > > Here is the fool stack trace as reported by HTTP 500:
> > >
> > > javax.servlet.ServletException: Wrapper cannot find servlet class
> > > org.apache.cactus.server.runner.ServletTestRunner or a class it
> depends
> > > on
> >
> > [snip]
> >
> > > root cause
> > >
> > > java.lang.ClassNotFoundException:
> > > org.apache.cactus.server.runner.ServletTestRunner
> >
> > [snip]
> >
> > > The error reported is different from the one I got before copying all
> of
> > > the cactus libs to WEB-INF/lib,
> > > it can at least find HttpServlet! ;)
> > >
> > > Any ideas? Merci,
> >
> > Classloaders are the hardest thing to understand and I believe you have
> a
> > classloader issue here. Am I right in thinking that you have a cactus
> jar in
> > your System classpath or in jboss somewhere? If so, remove the cactus
> jar
> > from all CPs and make sure that the only place it is put is in WEB-
> INF/lib
> > of your webapp.
> >
> > Try that and it should work.
> >
> > -Vincent
> >
> > > Mike
> > >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________

Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !

Yahoo! Mail : http://fr.mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to