2 Replies Latest reply on Dec 17, 2007 11:55 AM by Ralph Hyland

    FaceletViewHandler handleRenderException

    Ralph Hyland Newbie

      Hi,

      Having a lot of trouble with the following.

      When invalid credentials are entered when logging in to our system we see NPEs in the logs and no login failed message appears on screen.

      Here is the set up:

      components.xml -

      <security:identity jaas-config-name="ourname" scope="session"/>


      login-config.xml -
      <application-policy name = "ourname">
       <authentication>
       <login-module code="com.company.OurLoginModule" flag = "required">
       </login-module>
       </authentication>
       </application-policy>
      </policy>


      login.jspx (snippet) -
      <tr>
      <td colspan="2" align="right">
      <h:commandButton type="submit"
      value="#{msg.button_login}"
      action="#{identity.login}"
      style="font-size: 14px;"
      styleClass="button"/>
      </td>
      </tr>


      Login module class snippet:

      public class OurLoginModule extends UsernamePasswordLoginModule {
      
      @Override
       public boolean login() throws LoginException
       {
       boolean loginOk = super.login();
      
       return loginOk;
       }
      }
      
      When


      Here is the start of the stack trace:

      2007-12-14 12:22:07,770 ERROR [STDERR] Dec 14, 2007 12:22:07 PM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/WelcomePage.jspx]
      java.lang.NullPointerException
      at org.apache.el.lang.FunctionMapperImpl$Function.writeExternal(FunctionMapperImpl.java:123)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.HashMap.writeObject(HashMap.java:1001)
      at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at org.apache.el.lang.FunctionMapperImpl.writeExternal(FunctionMapperImpl.java:74)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at org.apache.el.ValueExpressionImpl.writeExternal(ValueExpressionImpl.java:256)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at com.sun.facelets.el.TagValueExpression.writeExternal(TagValueExpression.java:128)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)


      Server: JBoss-4.2.0-GA
      Seam: Implementation-Version: 1.2.1.GA

      Any suggestions appreciated.
      Thanks
      Ralph

        • 1. Re: FaceletViewHandler handleRenderException
          Ralph Hyland Newbie

          just to clarify something here: i do see the FailedLoginException in the logs but straight after that the NPE is thrown.
          Also, have tried catching the FailedLoginException within pages.xml but it does not catch it. As a test i've caught NullPointerException in pages.xml and that does work, but obviously we don't want to display a login message anytime a NPE is thrown within our application.

          • 2. Re: FaceletViewHandler handleRenderException
            Ralph Hyland Newbie

            I seem to have fixed this problem by doing the following in pages.xml:
            (Added code in bold)

            <page view-id="*">
             <navigation>
             <rule if="#{not identity.loggedIn}">
             <redirect view-id="/WelcomePage.xhtml">
             <message>Invalid username or password entered</message>
             </redirect>
             </rule>
             </navigation>
            
             <navigation from-action="#{userHome.logout}">
             <redirect view-id="/WelcomePage.xhtml"/>
             </navigation>
             </page>


            I don't see the NPE happening in the logs anymore and my error message is displayed to the user (along with the built in 'Login Failed' message).