Thursday, January 7, 2010

Hudson and Jetty, avoiding the error: IllegalStateException, Form too large

Hudson comes packed in an 'out of the box' war file which works fine just putting it in the 'webapps' folder of any servlet container. Unfortunately jetty has a restriction which makes some hudson's features fail, this constrain is the max size allowed for a posted form request, which comes configured with a default value of 200,000 Bytes, since hudson sends sometimes ajax requests quite larger. This failure produces messages in jetty log files like:

java.lang.IllegalStateException: Form too large 218722>200000
 at org.eclipse.jetty.server.Request.extractParameters(

To avoid this error, just create a configuration file for hudson in the contexts folder of jetty:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/hudson</Set>
  <Set name="war"><Systemproperty name="jetty.home" default="."/>/webapps/hudson.war</Set>
  <Set name="maxFormContentSize" type="int">600000</Set>