users@glassfish.java.net

RE: Obtaining LoginException

From: Shevland, Joe <joe.shevland_at_capgemini.com>
Date: Fri, 3 Aug 2007 10:10:34 +1000

> The error information is exposed to a JSP error page via the
> page context's ErrorData variable, which is populated from
> the following servlet request attributes:
>
> javax.servlet.error.exception
> javax.servlet.error.status_code
> javax.servlet.error.request_uri
> javax.servlet.error.servlet_name
>
> In your JSP error page, you may access this information
> conveniently via the Expression Language, as follows:
>
> ${pageContext.errorData.throwable}
> ${pageContext.errorData.statusCode}
> ${pageContext.errorData.requestURI}
> ${pageContext.errorData.servletName}
>
>
> Jan

Thanks Jan, looks perfect, although I'm seeing an NPE when I try; I
wasn't sure about the need for isErrorPage="true" in the error page, but
I've tried with and without. With, the generated servlet code NPE's at:

 
response.setStatus(((Integer)request.getAttribute("javax.servlet.error.s
tatus_code")).intValue());

with the stack trace:

        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWork
erThread.java:106)
Caused by: java.lang.NullPointerException
        at
org.apache.jsp.login.login_005ferror_jsp._jspService(login_005ferror_jsp
..java:26)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:373)
        ... 35 more

using:

   <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>custom_realm</realm-name>
      <form-login-config>
        <form-login-page>/login/login.jsp</form-login-page>
        <form-error-page>/login/login_error.jsp</form-error-page>
      </form-login-config>
   </login-config>

And without the stack trace is altered a little, but still NPE's when
accessing pageContext.getErrorData(). Might be something I'm not
configuring correctly (version is v2 b50g).

Regards
Joe

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.