File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes file uploading error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "file uploading error" Watch "file uploading error" New topic
Author

file uploading error

krishna prakash
Greenhorn

Joined: Apr 02, 2009
Posts: 7
I am getting this error when am uploading file in jsp

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

java.lang.IllegalArgumentException: Cannot invoke com.cisco.struts.form.UploadformForm.setUploadFile - argument type mismatch
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1778)
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


Thanks,
Krishna
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

I'm no struts 1.x guru, but looking at this faq entry, it looks like the name of the html:file field and the form bean property don't match...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Arun Ak
Greenhorn

Joined: Jun 21, 2009
Posts: 21
<s:form namespace="/admin" enctype="multipart/form-data">

----
<s:file name="file"/>

---
</s:form>

in java bean
Test{

File file;

getFile();
setFile(File file)
}
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Er, are those Struts 2 tags?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file uploading error