3 Replies Latest reply on Jan 1, 2008 5:54 AM by Sergey Smirnov

    First forward to main page gets 404, but simple JSF app work

    David M. Karr Newbie

      I've just started to look deeply into JSF. I'm deploying some test apps to WebLogic 9.2.2. I have two simple apps I'm testing. One is a plain JSF app, and the other is the "echo" RichFaces app.

      When I go to the URL for the plain JSF app, the "index.jsp" successfully forwards to the main page, and it shows up.

      When I go to the URL for the RichFaces "echo" app, I immediately get a 404.

      I added some debug, so I know that it executes my "index.jsp". I also set a breakpoint in org.ajax4jsf.webapp.BaseFilter.doFilter(), and I see it hit that. I also added a debugging lifecycle listener.

      So, with this debug enabled, I get this:


      [DEBUG] BaseFilter - Filter start request processing at 12/31/07 12:05 PM for uri: /AjaxEcho/faces/echo.jsp
      [DEBUG] BaseFilter - Filter request output to XML
      BeforePhase: RESTORE_VIEW 1
      AfterPhase: RESTORE_VIEW 1
      BeforePhase: RENDER_RESPONSE 6
      AfterPhase: RENDER_RESPONSE 6
      [DEBUG] BaseFilter - Finished request processing total time 31ms for uri: /AjaxEcho/faces/echo.jsp

      But I still get a 404.

      What else can I look at to determine what might be going wrong here?

        • 1. Re: First forward to main page gets 404, but simple JSF app
          David M. Karr Newbie

          If it helps, I managed to turn on debugging for "com.sun.faces" and "org.ajax4jsf", which produced the output following this. This didn't help me find a solution.

          [DEBUG] BaseFilter - Filter start request processing at 12/31/07 1:57 PM for uri: /AjaxEcho/faces/echo.jsp
          [DEBUG] BaseFilter - Filter request output to XML
          [DEBUG] BaseXMLFilter - XML filter service start processing request
          [DEBUG] LifecycleImpl - execute(com.sun.faces.context.FacesContextImpl@1539b09)
          [DEBUG] AjaxPhaseListener - Process before phase RESTORE_VIEW 1
          [DEBUG] InitPhaseListener - Perform additional framework initialization on first request
          BeforePhase: RESTORE_VIEW 1
          [DEBUG] RestoreViewPhase - Entering RestoreViewPhase
          [DEBUG] ViewHandlerImpl - URL pattern of the FacesServlet executing the current request /faces
          [DEBUG] AjaxStateManager - Can't restore view state : no saved view states in se ssion
          [DEBUG] AjaxViewHandler - Detect session expiration in AJAX request - view don't restored for a viewId /echo.jsp
          [DEBUG] RestoreViewPhase - New request: creating a view for /echo.jsp
          [DEBUG] ViewHandlerImpl - Created new view for /echo.jsp
          [DEBUG] ViewHandlerImpl - Locale for this view as determined by calculateLocale en
          [DEBUG] ViewHandlerImpl - RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC
          [DEBUG] RestoreViewPhase - Exiting RestoreViewPhase
          AfterPhase: RESTORE_VIEW 1
          [DEBUG] InitPhaseListener - Remove init phase listener from factories
          [DEBUG] LifecycleImpl - removePhaseListener(ANY 0,org.ajax4jsf.event.InitPhaseListener@b61de0
          [DEBUG] AjaxPhaseListener - Process after phase RESTORE_VIEW 1
          [DEBUG] LifecycleImpl - Skipping rest of execute() because of a reload
          [DEBUG] LifecycleImpl - render(com.sun.faces.context.FacesContextImpl@1539b09)
          [DEBUG] AjaxPhaseListener - Process before phase RENDER_RESPONSE 6
          [DEBUG] AjaxPhaseListener - PhaseListener enter Before RenderView Phase with ViewId /echo.jsp and RenderKitId HTML_BASIC
          BeforePhase: RENDER_RESPONSE 6
          [DEBUG] RenderResponsePhase - Entering RenderResponsePhase
          [DEBUG] RenderResponsePhase - About to render view /echo.jsp
          [DEBUG] ViewHandlerImpl - About to render view /echo.jsp
          [DEBUG] ViewHandlerImpl - URL pattern of the FacesServlet executing the current request /faces
          [DEBUG] ViewHandlerImpl - Found no URL patterns mapping to FacesServlet
          [DEBUG] AjaxContext - Process component tree for collect used scripts and styles
          [DEBUG] InternetResourceBuilder - Return instance of internet resource builder org.ajax4jsf.resource.ResourceBuilderImpl@1011211
          [DEBUG] RenderResponsePhase - Exiting RenderResponsePhase
          AfterPhase: RENDER_RESPONSE 6
          [DEBUG] AjaxPhaseListener - Process after phase RENDER_RESPONSE 6
          [DEBUG] BaseXMLFilter - create HTML/XML parser for content type: null
          [DEBUG] BaseXMLFilter - Parser not have support for the such content type, send response as-is
          [DEBUG] BaseFilter - Finished request processing total time 17721ms for uri: /AjaxEcho/faces/echo.jsp

          • 2. Re: First forward to main page gets 404, but simple JSF app
            David M. Karr Newbie

            I got this working, but it sure seems odd to me. In the working JSF app, I didn't notice that the forward from "index.jsp" references "/faces/main.jsp", even though "main.jsp" is in the root of the app. I changed my RichFaces app to do the same, so it references the "fake" root directory of "/faces". Now it works fine, it's just odd looking. I didn't notice this being called out in the JSF book (Complete Reference).

            • 3. Re: First forward to main page gets 404, but simple JSF app
              Sergey Smirnov Master

              Each JSF request should pass the JSF servlet.
              It was too much obvious for the book released 3 years after the JSF took place.