title: javax.crypto.BadPaddingException: Given final block not properly padded
body: <p>While launching my web application I am getting the following error:</p>
  
  <blockquote>
    <p>javax.crypto.BadPaddingException: Given final block not properly padded<br>
    Caused by:<br>
    javax.crypto.BadPaddingException - Given final block not properly padded</p>
  </blockquote>
  
  <p>Stack Trace:</p>
  
  <pre><code>javax.faces.FacesException: javax.crypto.BadPaddingException: Given final block not properly padded
       at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:474)
       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)
       at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getTreeStructureToRestore(HtmlResponseStateManager.java:151)
       at org.ajax4jsf.application.AjaxStateManager.restoreLogicalViewId(AjaxStateManager.java:564)
       at org.ajax4jsf.application.AjaxStateManager.restoreStateFromSession(AjaxStateManager.java:495)
       at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:444)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:515)
       at com.sun.facelets.FaceletViewHandler.restoreView(FaceletViewHandler.java:316)
       at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
       at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:85)
       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 com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
       at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
       at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
       at com.nsn.calypso.LocaleFilter.doFilter(LocaleFilter.java:72)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
       at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
       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)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
       at com.nsn.calypso.security.BackButtonFilter.doFilter(BackButtonFilter.java:32)
       at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
       at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
       at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:850)
       at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:693)
       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:589)
       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:534)
       at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
       at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:450)
       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:508)
       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:296)
       at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
       at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
  Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
       at com.ibm.crypto.provider.DESCipher.engineDoFinal(Unknown Source)
       at com.ibm.crypto.provider.DESCipher.engineDoFinal(Unknown Source)
       at javax.crypto.Cipher.doFinal(Unknown Source)
       at org.apache.myfaces.shared_impl.util.StateUtils.symmetric(StateUtils.java:470)
       ... 58 more
  </code></pre>