3 Replies Latest reply on Apr 21, 2010 9:30 AM by Nick Belaevski

    Given final block not properly padded

    Rand Asin Novice

      I have a simple page with some menuItems like the demo page.  I noticed the following steps cause error: Given final block not properly padded


      1. Load my page (i.e .menu.faces)
      2. restart JBoss or let my session time out
      3. Click on a menu item without reloading menu.faces


      I get


      javax.crypto.BadPaddingException: Given final block not properly padded
          at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
          at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
          at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)
          at javax.crypto.Cipher.doFinal(DashoA13*..)
          at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:470)
          at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:512)
          at org.apache.myfaces.shared_impl.util.StateUtils.decrypt(StateUtils.java:312)
          at org.apache.myfaces.shared_impl.util.StateUtils.reconstruct(StateUtils.java:261)
          at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getSavedState(HtmlResponseStateManager.java:187)


      I noticed the similar issue on RichFaces Online Demo if I leave the browser open for a long time and then try to interact with the menu demo.  Looks like it's trying to restore state, but the session no longer exists.  I don't understand why since none of my beans are session scope.  Are the menu components stateful?  How do I get around this issue?


      Any thoughts would be appreciated.  Thanks.

        • 2. Re: Given final block not properly padded
          Rand Asin Novice

          That fixed the BadPaddingException, but I am getting



          javax.faces.application.ViewExpiredException: /Page.facesNo saved view state could be found for the view identifier: /Page.faces
              at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88)
              at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
              at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:178)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)


          I think my core issue remains that view is stateful when I don't want it to be.  How should I design my view so it's not stateful?  My beans are request scope only, what else should I look for?


          BTW where can I change my JBoss Community account password?  Got a notification from JBoss the other day to reset my password, now I can't find the place to change my password.  Any help would be appreciated.

          • 3. Re: Given final block not properly padded
            Nick Belaevski Master

            In JSF views are stateful, unless you've set it to "transient".