4 Replies Latest reply on Aug 27, 2018 11:03 AM by javacoryd

    j_exception in wildfly 10

    sahidkhn

      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
          sahidkhn

          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

            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
              sahidkhn

              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?

              • 4. Re: j_exception in wildfly 10
                javacoryd

                Did this question ever get resolved? 

                 

                We are running into the same issue.

                 

                Thanks!

                 

                Cory.