I'll wait until the 1.1 version. Thanks for your assistance, Vincent.

Keith Pierce
FedACH Support Services
Federal Reserve Bank of Minneapolis
612-204-6480

> -----Original Message-----
> From: Vincent Massol [SMTP:[EMAIL PROTECTED]]
> Sent: Sunday, June 17, 2001 3:20 PM
> To:   Jon Belinfante; [EMAIL PROTECTED]
> Cc:   Leslie Klein
> Subject:      Re: Cactus Error on testing servlet.doPost Method
> 
> Hi Jon,
> 
> I have (finally) tried the classes that you sent ... and they do run fine
> on
> my machine. However, as I am using the latest Cactus code from CVS, maybe
> it
> was a bug that has been corrected ... I have run your code on Tomcat 3.2.1
> (not using JBoss, directly on Tomcat).
> 
> Can you try with the CVS version of Cactus (or wait until tomorrow night
> as
> I will deliver the 1.1 version of Cactus - if everything goes allright ..)
> ?
> 
> Thanks
> Vincent.
> 
> ----- Original Message -----
> From: "Jon Belinfante" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "Vincent Massol"
> <[EMAIL PROTECTED]>
> Cc: "Leslie Klein" <[EMAIL PROTECTED]>
> Sent: Tuesday, May 29, 2001 2:29 PM
> Subject: Re: Cactus Error on testing servlet.doPost Method
> 
> 
> > Vincent
> >
> > I have dome more investigation on this problem I have been getting.
> > I   have written the following servlet and test case as attached.
> >
> > (See attached file: TestViewStaffResourceServlet.java)(See attached
> file:
> > ViewStaffResourceServlet.java)
> >
> > And when running them I still get the following errors.
> >
> > From tomcat
> >
> > 001-05-29 01:50:57 - Ctx( /staffResource ): Exception in: R(
> /staffResource +
> > /ServletRedirector + null) - java.lang.ClassCastException:
> > org.apache.commons.cactus.ServletTestResult
> >        at
> >
> org.apache.commons.cactus.server.ServletTestCaller.doGetResults(ServletTes
> tC
> aller.java:201)
> >        at
> >
> org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTestR
> ed
> irector.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:
> 79
> 7)
> >        at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> >        at
> >
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
> pC
> onnectionHandler.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 from the JUnit  dialog
> >
> > java.io.FileNotFoundException:
> > http://localhost:8080/staffResource/ServletRedirector
> >      at
> >
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnecti
> on
> .java:549)
> >      at
> >
> org.apache.commons.cactus.client.ServletHttpClient.doTest(ServletHttpClien
> t.
> java:119)
> >      at
> >
> org.apache.commons.cactus.ServletTestCase.runGenericTest(ServletTestCase.j
> av
> a:153)
> >      at
> >
> org.apache.commons.cactus.ServletTestCase.runTest(ServletTestCase.java:128
> )
> >      at
> >
> org.apache.commons.cactus.AbstractTestCase.runBare(AbstractTestCase.java:2
> 66
> )
> >
> >
> > This is the same error and same trace I was getting before as far as I
> know.
> > But there is progress .....
> >
> > Within the Servlet method with the doSessionRequest method there are a
> set
> of
> > out.println() calls to build up some response HTML.
> > With these out.println() methods then the problem above occurs but if
> one
> > removes these print calls so there is no reponse HTML then the problem
> > disappears and tests work correctly, and test cases can be handled. Thus
> it
> > seems to me that there seems a conflict somewhere in the test suite code
> when
> > there is a session object and response data being BOTH sent back from a
> > PostMethod.
> >
> > Other to you guys on this one, as I have not gone down the root of
> trying
> to
> > resolve where theere may be a problem in the Cactus code.
> > If it helps I am using the download of cactus common-cactus-23-20010502.
> >
> > Please if someone can get to me with a resolution, I will be most
> greatful.
> >
> > Cheers  and thanks for any assistance to a real problem.
> >
> > Jon Belinfante
> >
> >
> >
> >
> > |--------+----------------------->
> > |        |          "Vincent     |
> > |        |          Massol"      |
> > |        |          <vmassol@octo|
> > |        |          .com>        |
> > |        |                       |
> > |        |          28/05/01     |
> > |        |          19:53        |
> > |        |          Please       |
> > |        |          respond to   |
> > |        |          jakarta-commo|
> > |        |          ns; Please   |
> > |        |          respond to   |
> > |        |          "Vincent     |
> > |        |          Massol"      |
> > |        |                       |
> > |--------+----------------------->
> >
> >-------------------------------------------------------------------------
> --
> -|
> >   |
> |
> >   |       To:     [EMAIL PROTECTED]
> |
> >   |       cc:     (bcc: Jon Belinfante/London/CWB)
> |
> >   |       Subject:     Re: Cactus Error on testing servlet.doPost Method
> |
> >
> >-------------------------------------------------------------------------
> --
> -|
> >
> >
> >
> >
> > Hi Jon,
> >
> > A few general remarks first :) (we'll tackle the hard problems just
> after
> > ... )
> >
> > * The beginXXX() methods are optional so if you don't use it, you can
> simply
> > remove it from the test, making it more readable
> > * If you're testing for a positive response, like a doPost that executes
> > correctly, you shouldn't try to catch a possible error in a try/catch
> block.
> > Just let the exception be bounced up in the call stack. It will
> eventually
> > be picked up by the JUnit test runner. Again, this is to make it easier
> to
> > read a test and guess it's intent.
> >
> > Ok, now the hard part ...
> >
> > It actually looks quite strange. The line that seems to cause problem
> seems
> > to be the following from ServletTestCaller.java (although I am not sure
> as
> I
> > may be using a newer version than yours)
> >
> > "        ServletTestResult result =
> >
> (ServletTestResult)theObjects.m_Config.getServletContext().getAttribute(TE
> ST
> > _RESULTS);"
> >
> > This line could return a null value if the attribute is not set but I
> don't
> > see how it could return an object of a type different than a
> > ServletTestResult unless :
> > * The getAtrtibute(TEST_RESULTS) calls returns a java object that is not
> a
> > ServletTestResult but as TEST_RESULTS is declared as 'private final
> static
> > String TEST_RESULTS = "ServletTestRedirector_TestResults";', I don't see
> how
> > this value could have been overwritten ...
> >
> > No, sorry, I don't get it ... Could you try to trim your class under
> test
> > and your test class so that it contains minimum code (remove any
> unnecessary
> > code) that still triggers the error. Once done, could you send it to the
> > list ?
> >
> > Thanks.
> > Vincent.
> >
> > ----- Original Message -----
> > From: "Jon Belinfante" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, May 24, 2001 5:49 PM
> > Subject: Cactus Error on testing servlet.doPost Method
> >
> >
> > > 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(ServletTes
> tC
> > aller.java:201)
> > >         at
> > >
> >
> org.apache.commons.cactus.server.ServletTestRedirector.doPost(ServletTestR
> ed
> > irector.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:
> 79
> > 7)
> > >         at
> > > org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> > >         at
> > >
> >
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
> pC
> > onnectionHandler.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(HttpURLConnecti
> on
> > .java:549)
> > >      at
> > >
> >
> org.apache.commons.cactus.client.ServletHttpClient.doTest(ServletHttpClien
> t.
> > java:119)
> > >      at
> > >
> >
> org.apache.commons.cactus.ServletTestCase.runGenericTest(ServletTestCase.j
> av
> > a:153)
> > >      at
> > >
> >
> org.apache.commons.cactus.ServletTestCase.runTest(ServletTestCase.java:128
> )
> > >      at
> > >
> >
> org.apache.commons.cactus.AbstractTestCase.runBare(AbstractTestCase.java:2
> 66
> > )
> > >
> > > 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
> > >
> > >
> > >
> >
> **************************************************************************
> **
> >
> **************************************************************************
> > > This e-mail has been prepared using information  believed  by  the
> author
> > > to be reliable and accurate, but CWB makes  no  warranty  as to
> accuracy
> > or
> > > completeness. In particular CWB does not  accept  responsibility  for
> > > changes  made to this e-mail after it was sent.  Any  opinions
> expressed
> > in
> > > this document are those of the author and do  not  necessarily reflect
> the
> > > opinions of the company or its affiliates. They may be subject to
> change
> > > without notice.
> > >
> >
> **************************************************************************
> **
> >
> **************************************************************************
> *
> > >
> > >
> > >
> >
> >
> >
> >
> > (UUEncoded file named: TestViewStaffResourceServlet.java follows)
> >
> >
> 
> 
> --------------------------------------------------------------------------
> --
> ----
> 
> 
> >
> > (UUEncoded file named: ViewStaffResourceServlet.java follows)
> >
> >
> 
> 
> --------------------------------------------------------------------------
> --
> ----
> 
> 
> >
> >
> >

Reply via email to