title: java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute with name
body: <p>I am new to Spring MVC, trying to write the web based application ...getting following error.....</p>
  
  <pre><code> org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: setAttribute:
  </code></pre>
  
  <p>Non-serializable attribute with name 
  InventoryMgmtSpring.web.PriceIncreaseFormController.FORM.priceIncrease
  root cause</p>
  
  <pre><code> java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute with name InventoryMgmtSpring.web.PriceIncreaseFormController.FORM.priceIncrease
  </code></pre>
  
  <p>code snippet from app-servelet.xml</p>
  
  <pre><code>  &lt;bean name="/priceincrease.htm"   class="InventoryMgmtSpring.web.PriceIncreaseFormController"&gt;
      &lt;property name="sessionForm" value="true"/&gt;
      &lt;property name="commandName" value="priceIncrease"/&gt;
      &lt;property name="commandClass" value="InventoryMgmtSpring.service.PriceIncrease"/&gt;
      &lt;property name="validator"&gt;
          &lt;bean class="InventoryMgmtSpring.service.PriceIncreaseValidator"/&gt;
      &lt;/property&gt;
      &lt;property name="formView" value="priceincrease.htm"/&gt;
      &lt;property name="successView" value="hello.htm"/&gt;
      &lt;property name="productManager" ref="productManager"/&gt;
  &lt;/bean&gt; 
  </code></pre>
  
  <h2>code from PriceIncreaseFormController -----</h2>
  
  <pre><code> public class PriceIncreaseFormController extends SimpleFormController {
  
  /** Logger for this class and subclasses */
  protected final Log logger = LogFactory.getLog(getClass()); 
  private ProductManager productManager; 
  
  public ModelAndView onSubmit(Object command) throws ServletException { 
      int increase = ((PriceIncrease) command).getPercentage();
      logger.info("Increasing prices by " + increase + "%."); 
      productManager.increasePrice(increase); 
      logger.info("returning from PriceIncreaseForm view to " + getSuccessView()); 
      return new ModelAndView(new RedirectView(getSuccessView()));
  } 
  
  protected Object formBackingObject(HttpServletRequest request) throws ServletException {
      PriceIncrease priceIncrease = new PriceIncrease();
      priceIncrease.setPercentage(20);
      return priceIncrease;
  } 
  public void setProductManager(ProductManager productManager) {
      this.productManager = productManager;
  } 
  public ProductManager getProductManager() {
      return productManager;
      } 
      }
  </code></pre>
  
  <p>code snippet from PriceIncrease
  =------------------------------</p>
  
  <pre><code> public class PriceIncrease {
  
  /** Logger for this class and subclasses */
  
  protected  final Log logger = LogFactory.getLog(getClass());
  private int percentage ;
  public void setPercentage(int i)
  {
      this.percentage=i;
      logger.info("Percentage set to" + i);
  }
  public int getPercentage()
  {
      return percentage;
    }
   }
  </code></pre>