Bob

The test that fails is the third in the suite. The prior tests call the servlet
to test EJBs; which work as expected.

I do not know whether this helps. So I do not know whether your patch is
relevent.

Thanks
Jon Belinfante


|--------+------------------------->
|        |          Bob Davison    |
|        |          <Bob.Davison@re|
|        |          uters.com>     |
|        |                         |
|        |          25/05/01 08:59 |
|        |          Please respond |
|        |          to             |
|        |          jakarta-commons|
|        |                         |
|--------+------------------------->
  >----------------------------------------------------------------------------|
  |                                                                            |
  |       To:     [EMAIL PROTECTED]                           |
  |       cc:     (bcc: Jon Belinfante/London/CWB)                             |
  |       Subject:     Re: Cactus Error on testing servlet.doPost Method       |
  >----------------------------------------------------------------------------|






On 24/05/2001 17:49:01 Jon Belinfante wrote:
> Hi Guys
>
> I am using Cactus to test a single servlet, connected to two EJB's in
> tomcat/jboss.
>
> All my tests on the servlet work except for when I try to test a doPost or a
> doGet servlet on the code.
>
> My code is as follows
>
>
>
> public void beginProcessRequest(ServletTestRequest theRequest)
>           throws IOException
>     {
>     }
>
>   public void testProcessRequest( )
>                throws IOException, Exception
>     {
>
>           ViewStaffResourceServlet servlet =
>                new ViewStaffResourceServlet();
>           try
>           {
>                servlet.init(config);
>
>                servlet.doPost( request, response);
>           }
>
>           catch (Exception e)
>           {
>                throw e;
>           }
> }
>
> public void endProcessrequest(HttpURLConnection theConnection)
> {
> }
>
> When I run this test I get error messages from both Tomcat and also in the
> Cactus Dialog.
> The Error from Tomcat is as follows
>
> 2001-05-24 05:41:00 - Ctx( /staffResource ): Exception in: R( /staffResource +
> /ServletRedirector + null) - java.lang.ClassCastException:
> org.apache.commons.cactus.ServletTestResult
>         at
>
org.apache.commons.cactus.server.ServletTestCaller.doGetResults(ServletTestCalle
> r.java:201)
>         at
>
org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTestRedirec
> tor.java:121)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>         at org.apache.tomcat.core.Handler.service(Handler.java:286)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConne
> ctionHandler.java:210)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
>
> And the Error from Cactus  is as follows
>
> java.io.FileNotFoundException:
> http://localhost:8080/staffResource/ServletRedirector
>      at
>
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.jav
> a:549)
>      at
>
org.apache.commons.cactus.client.ServletHttpClient.doTest(ServletHttpClient.java
> :119)
>      at
>
org.apache.commons.cactus.ServletTestCase.runGenericTest(ServletTestCase.java:15
> 3)
>      at
> org.apache.commons.cactus.ServletTestCase.runTest(ServletTestCase.java:128)
>      at
> org.apache.commons.cactus.AbstractTestCase.runBare(AbstractTestCase.java:266)
>
> I feel resonably confident that I have my configuration correct because I have
> other tests working correctly in the test suite - however I am always willing
to
> be proved wrong here.
> The name of my web-app here is staffResource.
>
> If anyone can help, I will be very greatful.
>
> Thanks
>
> Jon Belinfante
>

Jon,

Is the test that fails the first one run in the particular test suite and do you
make changes and use  Tomcat's or jBoss' class reloading facilities?

The reason I ask is that there is a known bug (#1612) whereby Cactus can attempt
to read the test results before they have been written and so either finds no
results or the previous tests results.  If the container has reloaded the Cactus
classes prior to the new test run then the previous test results will be from an
old classloader.  When Cactus attempts to read them in the new classloader a
ClassCastException will result.

I have submitted a patch to Vincent but I don't think that he has had time to
apply it yet.  I haven't seen the CVS commit messages anyway.

If this sounds like your problem then let me know and I will send you the
patches so you can keep working until the real fix appears.

.../Bob


-----------------------------------------------------------------
        Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.




Reply via email to