title: java.lang.IllegalArgumentException: argument type mismatch:when store the form values in Database
body: <p>I want to store form values in Database using struts
  My form Bean:</p>
  
  <pre><code>import org.apache.struts.action.ActionForm;
  import org.apache.struts.upload.FormFile;
      public class TeacherForm extends ActionForm {
  
      private String tfastname;
      private FormFile teacherImage;  
      private FormFile teacherprofile;
  
      public String getTfastname() {
  
          return tfastname;
      }
  
      public void setTfastname(String tfastname) {
          this.tfastname = tfastname;
      }
  
  
      public FormFile getTeacherImage() {
          return teacherImage;
      }
  
      public void setTeacherImage(FormFile teacherImage) {
          this.teacherImage = teacherImage;
      }
  
      public FormFile getTeacherprofile() {
          return teacherprofile;
      }
  
      public void setTeacherprofile(FormFile teacherprofile) {
          this.teacherprofile = teacherprofile;
  
      }
  </code></pre>
  
  <p>Below is the jsp:</p>
  
  <pre><code>&lt;form action="teacherregistration.html"  enctype="multipart/form-data"&gt;
              &lt;input type="hidden" name="method" value="teacherregister"&gt;&lt;/input&gt;
                         &lt;table class="tablecss" cellspacing="3" cellpadding="3"&gt;
                      &lt;tr&gt;
                          &lt;td align="right" valign="middle" width="10%"&gt;&lt;label
                              class="LblDialog"&gt;First Name&lt;/label&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text"  name="tfastname" id="fname"
                                  class="textBoxInDialog"/&gt;&lt;/td&gt;
  
                      &lt;tr&gt;    
  
                      &lt;td align="center" valign="middle" width="10%"&gt;&lt;label
                           class="textBoxInDialog"&gt;Upload Profile&lt;/label&gt;&lt;/td&gt;
                      &lt;td align="center" valign="middle" width="10%"&gt;&lt;input
                              type="file" id="teaprofile" name="teacherprofile"/&gt;&lt;/td&gt;
                      &lt;td align="center" valign="middle" width="10%"&gt;&lt;label
                           class="textBoxInDialog"&gt;Image&lt;/label&gt;&lt;/td&gt;
                      &lt;td align="center" valign="middle" width="10%"&gt;&lt;input
                              type="file" id="teaImageId" name="teacherImage" /&gt;&lt;img
                              id="imagePreview" src="#" alt="your image" width="70px"
                              height="70px"/&gt;&lt;/td&gt;    
                  &lt;/tr&gt;
  
                  &lt;/table&gt;
                  &lt;br /&gt;
                                  &lt;table id="parentReg" cellspacing="3" cellpadding="3" width="100%"&gt;
                      &lt;tr class="odd"&gt;
  
                          &lt;td colspan="3"&gt;&lt;center&gt;
                                  &lt;input type="submit" class="submitButton" id="buttonID"&gt;&lt;/input&gt;&lt;/td&gt;
                      &lt;/tr&gt;
  </code></pre>
  
  <p>In configuration file:</p>
  
  <pre><code>&lt;form-bean name="teacherregistorform" type="com.centris.campus.forms.TeacherForm" /&gt;
  
  &lt;action path="/teacherregistration"
              type="com.centris.campus.actions.TeacherRegistrationAction" input="/JSP/Teacher/TeacherRegistration.jsp" parameter="method"
              name="teacherregistorform" scope="request"&gt;
              &lt;forward name="teacherLogin" path="inAdminTeacherRegistration"/&gt;
          &lt;/action&gt;
  </code></pre>
  
  <p>In Action class:</p>
  
  <pre><code>import org.apache.struts.upload.FormFile;
  
      public ActionForward teacherregister(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception
          {
  
              TeacherForm tform=(TeacherForm)form;
              formFile = tform.getTeacherprofile();
                System.out.println("tfastname-----"+tform.getTfastname());
  
      }
  </code></pre>
  
  <p>Here am using log4j also when i click on submit button i will get below error:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Cannot invoke com.centris.campus.forms.TeacherForm.setTeacherprofile on bean class 'class com.centris.campus.forms.TeacherForm' - argument type mismatch - had objects of type "java.lang.String" but expected signature "org.apache.struts.upload.FormFile"
      at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2181)
      at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2141)
      at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1948)
      at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2054)
      at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1015)
      at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:830)
      at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
      at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:473)
      ... 25 more
  Caused by: java.lang.IllegalArgumentException: argument type mismatch
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2155)
      ... 32 more
  </code></pre>
  
  <p>please give me any solution how to solve this problem.
  This is helpful for me.</p>