jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Mick.Knut...@wellsfargo.com>
Subject FW: Error in CactusStrutsTestCase
Date Tue, 14 Dec 2004 23:51:51 GMT
> -----Original Message-----
> From: Mick.Knutson@wellsfargo.com [mailto:Mick.Knutson@wellsfargo.com]
> Sent: Tuesday, December 14, 2004 10:40 AM
> To: user@struts.apache.org
> Subject: RE: Error in CactusStrutsTestCase
> Importance: High
> 
> 
> Here is what I want to do.
> I want to loop through various scenarios.
> 1. add the parameters to each given scenario
> 2. execute the scenario
> 3. assert the outcome
> 4. start again from scratch.
> 
> Now when I put the setUp() and tearDown() around the whole 
> method, I get an ActionError thrown the very first iteration 
> that I KNOW 100% is not true as when I remove them, I get 14 
> iterations done without error.
> 
> So what to do without creating a new test method for each 
> scenario as there are too many scenarios.

Hmmmmm.... Okay... assuming that the failing test actually works when you do it by hand, these
are the possibilities I can think of:

1) You're screaming through the list to fast.  This makes no sense, except that I'm not familiar
enough with Cactus to know how it works.  If it's doing something funky with the requests
then this could be a problem.  Try putting a Thread.sleep(1000) or longer see if that helps.

2) Cactus is doing something odd with your requests in the setup you have.  Basically what's
happening is either the Action or the JSP is trying to write something to the reponse stream
after it's been closed, and apparently from what you're saying only under Cactus.  Since Cactus
inserts itself into the request/response process, I'm thinking that maybe it's actually Cactus
that's doing something weird in you setup.  Might be worthwhile to check the cactus list and
see what they say.
  
> 
> --------------------
> Mick Knutson
> Wells Fargo Business Direct
> (415) 222-1020
> 
> "This message may contain confidential and/or privileged 
> information. If you are not the addressee or authorized to 
> receive this for the addressee, you must not use, copy, 
> disclose, or take any action based on this message or any 
> information herein. If you have received this message in 
> error, please advise the sender immediately by reply e-mail 
> and delete this message. Thank you for your cooperation."
> --------------------
> 
> 
> 
> -----Original Message-----
> From: Jim Barrows [mailto:jbarrows@sssc.com]
> Sent: Monday, December 13, 2004 3:48 PM
> To: Struts Users Mailing List
> Subject: RE: Error in CactusStrutsTestCase
> 
> 
> > -----Original Message-----
> > From: Mick.Knutson@wellsfargo.com 
> [mailto:Mick.Knutson@wellsfargo.com]
> > Sent: Monday, December 13, 2004 4:44 PM
> > To: user@struts.apache.org
> > Subject: RE: Error in CactusStrutsTestCase
> > 
> > 
> > 
> > This one is a real pain because there is no real failure in 
> > my logs. Just
> > the error I posted which came from my testcase page only.
> > 
> > The closest thing I can figure, is this is where the error is 
> > happening:
> > ==============================================================
> > ===========
> > if(
> >             Constants.TRUE.equals(
> >                     
> request.getParameter(Constants.BUS_CARD_SELECTED)
> >                 )
> >         ) {
> >             navigationBean.setHasBusinessCard(true);
> >         } else {
> >            
> > request.getSession().removeAttribute(Constants.BUSINESSCARD_FORM);
> 
> This is the only place you're writing anything, and it's not 
> to the request.  So, I don't think it's here, I think it's 
> when you actually write to the request.  THat's what the 
> error message says.
> 
> >             navigationBean.setHasBusinessCard(false);
> >         }
> > 
> > 
> > Note that there are 17 iterations, and there are only 4 that 
> > have an if()
> > for them. 1 for each of our 4 products. This is the second 
> product in
> > the list. So one of the products (businessLine), was already 
> > executed in
> > this test before the businessCard which is where it fails.
> 
> 
> Move this one last, and see if the other three work.....
> 
> 
> > 
> > 
> > 
> > --------------------
> > Mick Knutson
> > Wells Fargo Business Direct
> > (415) 222-1020
> > 
> > "This message may contain confidential and/or privileged 
> > information. If you are not the addressee or authorized to 
> > receive this for the addressee, you must not use, copy, 
> > disclose, or take any action based on this message or any 
> > information herein. If you have received this message in 
> > error, please advise the sender immediately by reply e-mail 
> > and delete this message. Thank you for your cooperation."
> > --------------------
> > 
> > 
> > 
> > -----Original Message-----
> > From: Jim Barrows [mailto:jbarrows@sssc.com]
> > Sent: Monday, December 13, 2004 3:33 PM
> > To: Struts Users Mailing List
> > Subject: RE: Error in CactusStrutsTestCase
> > 
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Mick.Knutson@wellsfargo.com 
> > [mailto:Mick.Knutson@wellsfargo.com]
> > > Sent: Monday, December 13, 2004 4:20 PM
> > > To: user@struts.apache.org; cactus-user@jakarta.apache.org
> > > Subject: Error in CactusStrutsTestCase
> > > 
> > > 
> > > I have the following method that keeps failing and I don't 
> > > know why. The method should really only set a NavigationBean 
> > > into session, then forward to a page based on the action 
> parameter.
> > > ================================================================
> > > 
> > > public void testProductSelection() throws Exception {
> > >     // JUnitDoclet begin method productSelection
> > > 
> > >       NavigationBean navigationBean = null;
> > 
> > 
> > ummmm... where is the code in the action that is failing? 
> > 
> > <snip/>
> > 
> > The exception indicates that you are trying to write to a 
> > response that's  been committed, but your test harness 
> > doesn't help much in figuring out why.  Your test harnes is 
> > working, since it works 13 times before failing.
> > 
> > 
> > > I get this error on the 14th iteration:
> > > =============================================
> > > 
> > > 
> > > 
> > > java.lang.IllegalStateException: response already committed
> > > at 
> > > weblogic.servlet.internal.ServletResponseImpl.sendRedirect(Ser
> > > vletResponseImpl.java:584)
> > > at 
> > > servletunit.struts.StrutsResponseWrapper.sendRedirect(StrutsRe
> > > sponseWrapper.java:154)
> > > at 
> > > org.apache.struts.action.RequestProcessor.processForwardConfig
> > > (RequestProcessor.java:385)
> > > at 
> > > org.apache.struts.tiles.TilesRequestProcessor.processForwardCo
> > > nfig(TilesRequestProcessor.java:316)
> > > at 
> > > org.apache.struts.action.RequestProcessor.process(RequestProce
> > > ssor.java:231)
> > > at 
> > > org.apache.struts.action.ActionServlet.process(ActionServlet.j
> > > ava:1164)
> > > at 
> > > 
> > 
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
> > > at 
> > > servletunit.struts.CactusStrutsTestCase.actionPerform(CactusSt
> > > rutsTestCase.java:537)
> > > at 
> > > com.wf.bd.ice.creditapplication.CreditApplicationActionsTest.t
> > > estProductSelection(CreditApplicationActionsTest.java:195)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at 
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> > > orImpl.java:39)
> > > at 
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.java:25)
> > > at 
> > > org.apache.cactus.internal.AbstractCactusTestCase.runBareServe
> > > r(AbstractCactusTestCase.java:153)
> > > at 
> > > org.apache.cactus.internal.server.AbstractWebTestCaller.doTest
> > > (AbstractWebTestCaller.java:119)
> > > at 
> > > org.apache.cactus.internal.server.AbstractWebTestController.ha
> > > ndleRequest_aroundBody0(AbstractWebTestController.java:93)
> > > at 
> > > org.apache.cactus.internal.server.AbstractWebTestController.ha
> > > ndleRequest_aroundBody1$advice(AbstractWebTestController.java:124)
> > > at 
> > > org.apache.cactus.internal.server.AbstractWebTestController.ha
> > > ndleRequest(AbstractWebTestController.java)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doPost_aroundBo
> > > dy2(ServletTestRedirector.java:101)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doPost_aroundBo
> > > dy3$advice(ServletTestRedirector.java:124)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doPost(ServletT
> > > estRedirector.java)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doGet_aroundBod
> > > y0(ServletTestRedirector.java:72)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doGet_aroundBod
> > > y1$advice(ServletTestRedirector.java:124)
> > > at 
> > > org.apache.cactus.server.ServletTestRedirector.doGet(ServletTe
> > > stRedirector.java)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > > at 
> > > weblogic.servlet.internal.ServletStubImpl$ServletInvocationAct
> > > ion.run(ServletStubImpl.java:971)
> > > at 
> > > weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle
> > > tStubImpl.java:402)
> > > at 
> > > weblogic.servlet.internal.ServletStubImpl.invokeServlet(Servle
> > > tStubImpl.java:305)
> > > at 
> > > weblogic.servlet.internal.WebAppServletContext$ServletInvocati
> > > onAction.run(WebAppServletContext.java:6350)
> > > at 
> > > weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authe
> > > nticatedSubject.java:317)
> > > at 
> > > weblogic.security.service.SecurityManager.runAs(SecurityManage
> > > r.java:118)
> > > at 
> > > weblogic.servlet.internal.WebAppServletContext.invokeServlet(W
> > > ebAppServletContext.java:3635)
> > > at 
> > > weblogic.servlet.internal.ServletRequestImpl.execute(ServletRe
> > > questImpl.java:2585)
> > > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
> > > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
> > > 
> > > 
> > > 
> > > --------------------
> > > Mick Knutson
> > > Wells Fargo Business Direct Information Systems
> > > (415) 222-1020
> > > 
> > > "This message may contain confidential and/or privileged 
> > > information. If you are not the addressee or authorized to 
> > > receive this for the addressee, you must not use, copy, 
> > > disclose, or take any action based on this message or any 
> > > information herein. If you have received this message in 
> > > error, please advise the sender immediately by reply e-mail 
> > > and delete this message. Thank you for your cooperation."
> > > --------------------
> > > 
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > > 
> > > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message