0

I've got a JSF app built with MyFaces 1.2.8, Facelets 1.1.14 and building it with Tomcat 6 through it's plugin in Eclipse Ganymede.

I've just installed the latest versions of the above libs and on build, the app deploys ok and the server goes to start and immediately I get this:

javax.servlet.ServletException: javax.crypto.BadPaddingException: Given final block not properly padded

Googling this one points me towards this page the result of which is to disable the error handling of MyFaces and Facelets using this

    <context-param>
  <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
  <param-value>false</param-value>
 </context-param>
 <context-param>
  <param-name>facelets.DEVELOPMENT</param-name>
  <param-value>false</param-value>
 </context-param>
 <error-page>
  <exception-type>javax.servlet.ServletException</exception-type>
  <location>/error.jsp</location>
 </error-page> 

and most importantly use this:

org.apache.myfaces.USE_ENCRYPTION

set to false. I don't want to do this but there's no other useful info. Does anyone else know whether there's a workaround for this problem? I've only recently migrated from mojarra and I don't want to have to go back.

Would downgrading MyFaces work do we think? I'm going to try it.

Thanks IA.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
volvox
  • 3,014
  • 16
  • 51
  • 80
  • does it always give this exception? or only the first time you open a page – Bozho Mar 04 '10 at 23:05
  • I reckon probably >75% of the time. It wasn't long before, in order to get what I was working on sorted, I switched client encryption off, but obviously I don't wanna leave it like that. – volvox Mar 05 '10 at 01:39
  • Just curious: why did you replace Mojarra by MyFaces? – BalusC Mar 05 '10 at 02:41
  • 1
    From memory, the BadPaddingException appears sometimes when you restart the Tomcat server. I imagine this has something to do with a session being no longer valid. – James P. Mar 05 '10 at 11:47
  • @James P. this is also what I've read. The encryption key is being reissued and is thus not the same. This is no good for me right now, as I may need to restart the server at any time in dev and test. – volvox Mar 05 '10 at 11:51
  • I actually am getting errors using both implementations. This is the the error for the Apache implementation. I've switched to the RI am will post the other error now if I cannot fix it - I think its a more simple JSP version issue (#{..} is not allowed in template text). – volvox Mar 05 '10 at 11:52
  • @Mark Lewis: Since the error is produced when the page is simply reloaded, you can try force refreshing a page in your browser or, if you're using Eclipse, right-clicking a jsf/xhtml page and then selecting "Run as> Run On Server". – James P. Mar 05 '10 at 12:12
  • @James I've tried that already. That's the reason for the post. tomcat6 seems to fall over fairly regularly as I deploy as it has trouble tearing down the Mojarra runtime so I found myself restarting it through eclipse and it's all over the place. To be honest I'm using Sun's RI now so it's difficult to comment further. – volvox Mar 05 '10 at 13:00

1 Answers1

0

After scouting around, my own suggestion is to desist from using MyFaces in this situation, install the right Mojarra runtime to support the project you're doing, ensure you have all the jars installed correctly (which I didn't), double check your facelets configuration and read the manuals. It's a bit of a workaround using a different JSF implementation but it worked.

volvox
  • 3,014
  • 16
  • 51
  • 80