6 Replies Latest reply on Dec 23, 2008 5:05 PM by 655221

    Redirect to Error page when an exception occuers


      I want to catch all exceptions, it may happen in the main portal page or inside a portlet.
      When ever there is an exception, I want to redirect the user to and tell him to try after sometime.

      I already have such a feature for 404 (page not found), which works fine.
      But for exception its not working

      The setting in have in web.xml is


      I even tried putting exact exception thrown from the on screen stack trace, like


      But still no use. I get the main portal's header and then the menu bar, and few portlets and the one portlet that is generating exception, still prints the full stack trace and that kills the alignment, making a complete mess.

      I have weblogic 10.2 or weblogic 10.3.

      Is there any way, I can catch, where ever exception happens and redirect the user to the custom error page.

      Thanks in Advance

        • 1. Re: Redirect to Error page when an exception occuers
          a. Override your skeletons error.jsp to forward/redirect to your page.
          b. If you primarily use pageflow portlets Define a shared flow which has an exception handling method and direct it to your page. Reference the shared flow in each of your controllers (i think global.app is deprecated in 10 otherwise you could do this there). this lets you log some additional information, plus gives you the added flexibility of dealing with different exception types
          c. Override the path to error.jsp in your portlets properties (havent tested)

          Note if you are using servlets etc you still need your web.xml java.lang.Exception entry. The reason it doesnt get picked up is because the portal framework is handling the exception

          Edited by: deepshet on Dec 22, 2008 8:12 PM
          • 2. Re: Redirect to Error page when an exception occuers
            You can add following entry in your .portlet file for handling errors in portlets

            <netuix:proxyPortletContent errorUri="/portlet-error.jsp"/>
            • 3. Re: Redirect to Error page when an exception occuers
              Thanks Mr deepshet for your answers.

              a) Would you be kind enough to tell me what is the location of the skeletons error.jsp

              b) Defining a shared flow, I don't think this is possible as we are at the fag end of the project. Anyways i will try to edit the global.app.
              Again would you be kind enough to tell me, where to look for, the global.app.

              c) Does not look like it has any such properties

              Thanks a lot (a) and (b) seem promising but need elaborate change.

              There should be some better solution. I am sure many people have implemented this.

              Anyone out there who has done this, Please share the info
              • 4. Re: Redirect to Error page when an exception occuers
                Mr vkp,

                That sounds interesting, Will try it tomorrow morning.

                but again, we have like 200 odd portlets, Is there no way we can go on adding to each one of it.

                Is there any such property in .portal itself for all portlets inside it ?
                • 5. Re: Redirect to Error page when an exception occuers

                  a. if you dont have an error.jsp, look at the merged projects view in eclipse/workshop and copy that file to your project to your skeleton, and make modifications to it(window--> show view--> merged projects). Should be under the default skeleton.

                  b. Look at
                  If you need a code snippet let me know

                  c. If you look at the properties window for your portlet there should be a property called Error Page path

                  • 6. Re: Redirect to Error page when an exception occuers
                    This doesn't apply unless you are using JSR-168 portlets, but just in case: I saw a similar internal thread recently in which the developer was working with a JSR 168 portlet and could not get their customized skeleton error.jsp to take effect. This is what a portal guru told him:

                    Yes- it makes a big difference that you are using JSR168 portlets! You can specify the error page that gets redirected to in weblogic-portlet.xml.

                    For example: