3 Replies Latest reply on Sep 11, 2017 8:30 AM by S K

    j_exception in wildfly 10

    S K Newbie

      Is there any way to get a reference to the JAAS LoginException in the JSP? I'm looking for something similar to j_exception in tomcat. I'll need this to display customized error messages to the users. Can some one please help?

       

      Thanks.

        • 1. Re: j_exception in wildfly 10
          S K Newbie

          From the picketbox source code, I see any login exception is saved in the Security Context. But how do I access this from the JSP?

          • 2. Re: j_exception in wildfly 10
            jaikiran pai Master

            If you want to get hold of the exception thrown by the web server for your servlets, then the Servlet spec expects that you check for the attribute "javax.servlet.error.exception" in the request object:

             

            Like:

             

            final Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");

             

            You can find more details about it in the Servlet spec

             

            • 3. Re: j_exception in wildfly 10
              S K Newbie

              Thank you for your response. But isn't the control directed to form-error-page defined in web.xml if there is a JAAS LoginException? I suppose it'll not reach any servlet in case of a LoginException. I tried a scriplet in the form-error-page as you suggested. But its giving me null if I try the following in the form-error-page jsp.

               

              <%

                  Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");

                  System.out.println(t);

              %>

               

              Should I try anything else?