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

ClassCastException when casting WebAppRequestDispatcher

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4
    • Fix Version/s: 1.7
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Operating System: Windows NT/2K
      Platform: PC
    • Bugzilla Id:
      21484

      Description

      I wrote to test class to test a servlet which finally does a forward to a JSP.
      When I call the forward method on the RequestDispatcher, I get the following
      error. It looks like
      org.apache.cactus.server.RequestDispatcherWrapper.dispatch179_forward is trying
      to cast the WebAppRequestDispatcher to something it shouldn't. Here is the
      stack trace ...

      java.lang.ClassCastException:
      com.ibm.servlet.engine.webapp.WebAppDispatcherRequest
      at org.apache.cactus.server.RequestDispatcherWrapper.dispatch179_forward
      (LogAspect.aj(1k):102)
      at org.apache.cactus.server.RequestDispatcherWrapper.around179_forward
      (LogAspect.aj(1k):1149)
      at org.apache.cactus.server.RequestDispatcherWrapper.forward(LogAspect.aj
      (1k):99)
      at org.apache.cactus.server.RequestDispatcherWrapper.dispatch179_forward
      (LogAspect.aj(1k):104)
      at org.apache.cactus.server.RequestDispatcherWrapper.around179_forward
      (LogAspect.aj(1k):1149)
      at org.apache.cactus.server.RequestDispatcherWrapper.forward(LogAspect.aj
      (1k):99)
      at com.vanguard.services.presentation.state.HtmlResponse.createResponse
      (HtmlResponse.java:128)
      at com.vanguard.services.presentation.state.HtmlResponse.createResponse
      (HtmlResponse.java:92)
      at web.corpcontent.vanguardviews.controller.VanViewsController.createResponse
      (VanViewsController.java:260)
      at com.vanguard.services.presentation.Activity.execute(Activity.java:283)
      at com.vanguard.services.presentation.web.WebServlet.doGet(WebServlet.java:126)
      at com.vanguard.TestServlet.TestVanViewsServlet.testGetMethod
      (TestVanViewsServlet.java:61)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.apache.cactus.AbstractTestCase.runServerTest(AbstractTestCase.java:332)
      at org.apache.cactus.AbstractTestCase.runBareServerTest
      (AbstractTestCase.java:235)
      at org.apache.cactus.server.AbstractWebTestCaller.doTest
      (AbstractWebTestCaller.java:149)
      at org.apache.cactus.server.AbstractWebTestController.dispatch87_handleRequest
      (LogAspect.aj(1k):125)
      at org.apache.cactus.server.AbstractWebTestController.around87_handleRequest
      (LogAspect.aj(1k):1149)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest
      (LogAspect.aj(1k):101)
      at org.apache.cactus.server.ServletTestRedirector.dispatch113_doPost
      (LogAspect.aj(1k):123)
      at org.apache.cactus.server.ServletTestRedirector.around113_doPost(LogAspect.aj
      (1k):1149)
      at org.apache.cactus.server.ServletTestRedirector.doPost(LogAspect.aj(1k):109)
      at org.apache.cactus.server.ServletTestRedirector.dispatch112_doGet
      (LogAspect.aj(1k):96)
      at org.apache.cactus.server.ServletTestRedirector.around112_doGet(LogAspect.aj
      (1k):1149)
      at org.apache.cactus.server.ServletTestRedirector.doGet(LogAspect.aj(1k):92)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at com.ibm.servlet.engine.webapp.StrictServletInstance.doService
      (ServletManager.java:827)
      at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service
      (StrictLifecycleServlet.java:167)
      at com.ibm.servlet.engine.webapp.IdleServletState.service
      (StrictLifecycleServlet.java:297)
      at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service
      (StrictLifecycleServlet.java:110)
      at com.ibm.servlet.engine.webapp.ServletInstance.service
      (ServletManager.java:472)
      at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch
      (ServletManager.java:1012)
      at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch
      (ServletManager.java:913)
      at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch
      (WebAppRequestDispatcher.java:721)
      at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch
      (WebAppRequestDispatcher.java:374)
      at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward
      (WebAppRequestDispatcher.java:118)
      at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)
      at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook
      (WebAppInvoker.java:239)
      at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation
      (CachedInvocation.java:67)
      at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI
      (ServletRequestProcessor.java:151)
      at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service
      (OSEListener.java:315)
      at com.ibm.servlet.engine.http11.HttpConnection.handleRequest
      (HttpConnection.java:60)
      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
      at com.ibm.ws.util.CachedThread.run(ThreadPool.jav

        Activity

        Hide
        cmlenz Christopher Lenz added a comment -

        It is trying to cast it to org.apache.cactus.server.HttpServletRequestWrapper,
        which is normally a fairly safe cast.

        I think we need more information about the specific test and the code that leads
        to the forward, to find out why the request is not a HttpServletRequestWrapper
        but rather a WebAppDispatcherRequest.

        Show
        cmlenz Christopher Lenz added a comment - It is trying to cast it to org.apache.cactus.server.HttpServletRequestWrapper, which is normally a fairly safe cast. I think we need more information about the specific test and the code that leads to the forward, to find out why the request is not a HttpServletRequestWrapper but rather a WebAppDispatcherRequest.
        Hide
        vmassol Vincent Massol added a comment -

        Reopening after 1.5-beta1 release

        Show
        vmassol Vincent Massol added a comment - Reopening after 1.5-beta1 release
        Hide
        krishna71_98@yahoo.com Krishna Madabhushi added a comment -

        Created an attachment (id=7377)
        This is the state class which calls another class HtmlResponse to forward. I will attach that too.

        Show
        krishna71_98@yahoo.com Krishna Madabhushi added a comment - Created an attachment (id=7377) This is the state class which calls another class HtmlResponse to forward. I will attach that too.
        Hide
        krishna71_98@yahoo.com Krishna Madabhushi added a comment -

        Created an attachment (id=7378)
        This is the class which tries to do a RequestDispatcher.forward which fails.

        Show
        krishna71_98@yahoo.com Krishna Madabhushi added a comment - Created an attachment (id=7378) This is the class which tries to do a RequestDispatcher.forward which fails.
        Hide
        vmassol Vincent Massol added a comment -

        Hi Krishna,

        I don't know what the problem is. However, I remember adding more logging
        information some time ago. Could you try with the latest 1.6dev release (you
        can get that from the nightly build area)?

        Thanks

        Show
        vmassol Vincent Massol added a comment - Hi Krishna, I don't know what the problem is. However, I remember adding more logging information some time ago. Could you try with the latest 1.6dev release (you can get that from the nightly build area)? Thanks
        Hide
        vmassol Vincent Massol added a comment -

        It's an old issue now which we were not able to reproduce. Closing it. Can be reopened if required.

        Show
        vmassol Vincent Massol added a comment - It's an old issue now which we were not able to reproduce. Closing it. Can be reopened if required.

          People

          • Assignee:
            vmassol Vincent Massol
            Reporter:
            krishna71_98@yahoo.com Krishna Madabhushi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development