jump to navigation

File uploading using struts March 13, 2008

Posted by pci08 in error resolving.
trackback

1. 11:12:31,500 ERROR [...] java.lang.String
java.lang.ClassCastException: java.lang.String
at

com.praweda.rtgs.web.struts.InterfaceOutgoingFileFormAction.execute(InterfaceOutgoingFileFormAction.java

:70)
at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:43)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:189)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)

It Caused by :

Throws:
java.lang.IllegalArgumentException – if there is no property of the specified name
java.lang.NullPointerException – if the type specified for the property is invalid
java.lang.ClassCastException – if the property is not a String[].

resolved :
<form-bean
name=”InterfaceOutgoingFileForm”
type=”org.apache.struts.action.DynaActionForm”>
<form-property name=”password” type=”java.lang.String”/>
<form-property name=”fileName” type=”org.apache.struts.upload.FormFile”/>

2. java.lang.NoClassDefFoundError: org/apache/commons/fileupload/RequestContext
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getDeclaredConstructor(Class.java:1953)
at

com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper.<init>(MultiPartRequestWrapper.jav

a:89)
at com.opensymphony.webwork.dispatcher.DispatcherUtils.wrapRequest(DispatcherUtils.java:424)
at

com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:70)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0)

].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
at

org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)

Resolved : commons-fileupload.jar is added or replace with newest version

3. 08/03/13 11:33:53.812 rtgs: Servlet error
org.apache.commons.beanutils.ConversionException: Cannot assign value of type ‘java.lang.String’ to

property ‘fileName’ of type ‘org.apache.struts.upload.FormFile’
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:422)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1733)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

resolved :

<html:form action=”/…” focus=”password” enctype=”multipart/form-data”>

4. Missing class: org.apache.commons.io.output.DeferredFileOutputStream

resolved : adding newest version of commons-io.jar

Note : until this day, file upload still incomplete.

Logged By : K

Comments»

1. Hayden Steep - July 14, 2009

Thank you for this post. You helped me solve issue 2 quickly.

2. Administrator - July 15, 2009

Your welcome steep, we’re happy could help each other in java scope :d

K