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

    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?



        • 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:




            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");




              Should I try anything else?

              • 4. Re: j_exception in wildfly 10
                Cory Dahlstrom Novice

                Did this question ever get resolved? 


                We are running into the same issue.