JavaRanch Home    
 
This page:         last edited 26 August 2008         What's Changed?         Edit

Cannot Create Bean   

This is a very common error in Struts. Below is a list of possible causes in order of their likelihood:
  • You just plain misspelled the form bean class name. Look very carefully at the type attribute you specified in the <form-bean> stanza in the struts-config.xml file. Is there a misspelling? Are any letters in upper-case that should be in lower-case or visa-versa?
  • You forgot to compile the form bean. Make sure the class file actually exists in the appropriate subdirectory of WEB-INF/classes.
  • Your form bean does not extend org.apache.struts.action.ActionForm. This class must be somewhere in the ancestry of your form bean.
  • You've somehow made it so your form bean has no public constructor with no arguments. Remember, if you added a constructor with arguments, you must also add one without arguments.
  • Check to make sure that the package you've placed your bean in is not "java" or "java.something". Java does not allow you to use this package name for your own classes.



Return to Struts1Faq

JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton