Uploaded image for project: 'Cactus'
  1. Cactus
  2. CACTUS-22

ServletTestCase crashes with 'Not a valid response'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.4-beta1
    • Framework
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 9544

    Description

      Platform details:
      Weblogic 6.1 sp2, on Windows 2000 (5.00.2195)
      Java: Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
      Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

      Problems details:
      I was running my cactus test cases when I experienced the errors shown below.
      I was able to reproduce it consistently. It seems to be that whenever the
      servlet is initialised and doPost() is called, any action taken afterwards will
      result in this error. An example is providing a endXXX(WebResponse wr) method,
      and calling wr.getText() within the method. This was one case that triggered
      the error.

      The problems also seems to occur when re-deploying the application in WebLogic
      and not restarting the server.

      My code for the test case is as follows:

      public class FormConfigurationActionTest extends ServletTestCase {

      ActionServlet _servlet = null;

      public FormConfigurationActionTest(String testName)

      { super(testName); }

      public void setUp(){
      }

      public void tearDown()

      { _servlet = null; }

      public void beginCreateQuestionFromMenu_Update(WebRequest wRequest)

      { String pathInfo = null; String queryString = null; // Request variables expected wRequest.addParameter("formPrimaryContext", FormsConfigHelper.CONTEXT_CREATE_EDIT_QUESTION); wRequest.addParameter("updateFlag", FormsConfigHelper.ACTION_UPDATE); wRequest.addParameter("questionLanguageId", "1"); wRequest.addParameter("questionType", Question.BOOLEAN_QUESTION); wRequest.addParameter("questionDescription", "Is this working properly?"); // <form> Action wRequest.setURL ("localhost:7001", "/ermtest", "/forms/createeditquestion.do", pathInfo, queryString); }

      public void testCreateQuestionFromMenu_Update() {
      try

      { _servlet = new ActionServlet(); _servlet.init(config); _servlet.doPost(request,response); }

      catch (IOException e)

      { e.printStackTrace(); }
      catch (ServletException e) { e.printStackTrace(); }

      // ** AN ACTION HERE CAUSES THE ERROR
      }

      public static Test suite()

      { TestSuite suite = new TestSuite(); suite.addTest(new FormConfigurationActionTest ("testCreateQuestionFromMenu_Update")); return suite; }

      }

      *************************************

      Client-side stack trace:

      [junit] Running com.jobpartners.testsuite.FormConfigurationActionTest
      [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.072 sec
      [junit] Testsuite: com.jobpartners.testsuite.FormConfigurationActionTest
      [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 1.072 sec
      [junit]
      [junit] Testcase: testCreateQuestionFromMenu_Update took 1.062 sec
      [junit] Caused an ERROR
      [junit] Not a valid response
      [junit] org.apache.cactus.util.ChainedRuntimeException: Not a valid response

      [junit] at org.apache.cactus.client.WebTestResultParser.readRootElement(
      WebTestResultParser.java;org/apache/cactus/util/log/LogAspect.java(1k):134)
      [junit] at org.apache.cactus.client.WebTestResultParser.dispatch29_parse
      (WebTestResultParser.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
      [junit] at org.apache.cactus.client.WebTestResultParser.around29_parse(W
      ebTestResultParser.java;org/apache/cactus/util/log/LogAspect.java(1k):1221)
      [junit] at org.apache.cactus.client.WebTestResultParser.parse(WebTestRes
      ultParser.java;org/apache/cactus/util/log/LogAspect.java(1k):96)
      [junit] at org.apache.cactus.client.AbstractHttpClient.callGetResult(Abs
      tractHttpClient.java;org/apache/cactus/util/log/LogAspect.java(1k):231)
      [junit] at org.apache.cactus.client.AbstractHttpClient.dispatch1_doTest(
      AbstractHttpClient.java;org/apache/cactus/util/log/LogAspect.java(1k):123)
      [junit] at org.apache.cactus.client.AbstractHttpClient.around1_doTest(Ab
      stractHttpClient.java;org/apache/cactus/util/log/LogAspect.java(1k):1221)
      [junit] at org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHt
      tpClient.java;org/apache/cactus/util/log/LogAspect.java(1k):115)
      [junit] at org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTes
      tCase.java:457)
      [junit] at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.jav
      a:133)
      [junit] at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.j
      ava:400)
      [junit]
      [junit] Testcase: testCreateQuestionFromMenu_Update

      BUILD FAILED

      ****************************************

      Server-side stack trace

      <31-May-02 16:31:47 BST> <Error> <HTTP> <[WebAppServletContext(5690625,ermtest,/
      ermtest)] Servlet failed with Exception
      java.lang.NullPointerException
      at org.apache.cactus.server.AbstractTestCaller.doGetResults(AbstractTest
      Caller.java:195)
      at org.apache.cactus.server.AbstractTestController.dispatch79_handleRequ
      est(AbstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):12
      9)
      at org.apache.cactus.server.AbstractTestController.around79_handleReques
      t(AbstractTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):1147
      )
      at org.apache.cactus.server.AbstractTestController.handleRequest(Abstrac
      tTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
      at org.apache.cactus.server.ServletTestRedirector.dispatch88_doPost(Serv
      letTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):132)
      at org.apache.cactus.server.ServletTestRedirector.around88_doPost(Servle
      tTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
      rector.java;org/apache/cactus/util/log/LogAspect.java(1k):118)
      at org.apache.cactus.server.ServletTestRedirector.dispatch87_doGet(Servl
      etTestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):105)
      at org.apache.cactus.server.ServletTestRedirector.around87_doGet(Servlet
      TestRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1147)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
      ector.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
      pl.java:265)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
      pl.java:200)
      at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
      rvletContext.java:2495)
      at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
      pl.java:2204)
      at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
      at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
      >

      Attachments

        Activity

          People

            vmassol Vincent Massol
            josie.gioffre@jobpartners.com Josie Gioffre
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: