What version of Struts are you using? What version of Commons FileUpload? Did you try using the version of FileUpload that ships with your version of Struts?

Upgrading libraries to the latest version is never guaranteed to work, since they may not be binary-compatible with the version Struts was compiled against.

L.

dshivhare wrote:
Hello All,

I want to use struts dynamic form feature. There is form which has an upload file field. I am having the following
settings in struts config file

             <form-bean name="uploadItemForm"
type="org.apache.struts.validator.DynaValidatorForm">

                    <form-property name="newItem"
type="org.apache.struts.upload.FormFile" />

             </form-bean>

<action path="/uploadItem" type="net.anet.projects.UserMgmt.controller.UploadItemAction"
name="uploadItemForm">

                 <forward name="forwardPage"
path="/projects/UserMgmt/web/CPanelListBucketItem.jsp" contextRelative="true" />

                 <forward name="invalidSession"
path="/LoginUser.anet?showInvalid=true" contextRelative="true"/>

            </action>


the jsp file contains the following form settings

            <html:form action="uploadItem.anet"
enctype="multipart/form-data">

                    Select file: <html:file property="newItem"/>

            <html:submit value="Drop into bucket"/>

            </html:form>

code in UploadItemAction is:

             public class UploadItemAction extends Action{

                  public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{

System.out.println("Upload Item");
                                                     HttpSession session =
request.getSession();
                                                     String validSession
=(String)session.getAttribute("validLoginSession");
                                                     AtUsers
currentUser=GlobalEnv.getCurrentSessionUser(session);

                                                     boolean isSuperAdmin =
UserMgmtAPI.isApptilityAdmin(currentUser.getRoles());

if(validSession==null||validSession.equals("false")){ return (mapping.findForward("invalidSession"));
                                                     }

                                                   if(!isSuperAdmin){
return (mapping.findForward("accessVoilation"));
                                                   }

                                                  DynaValidatorForm
uploadItemForm=(DynaValidatorForm)form;
FormFile
newItem=(FormFile)uploadItemForm.get("newItem");
System.out.println(newItem.getFileName().toString()); AWSAuthConnection s3Conn= (AWSAuthConnection) request.getSession().getAttribute("S3_CONN");

                                                   S3Object s3Object = new
S3Object();

                                                   return
mapping.findForward("forwardPage");

                   }
             }

upon clicking the submit button in jsp I am getting the following error:

                   java.lang.NoSuchMethodError:
org.apache.commons.fileupload.FileUpload.setSizeMax(I)V

I have searched various mailing list and as suggeste by most of them,
downloaded the latest version of org.apache.commons.fileupload.jar

also tried deleting the previous version of
org.apache.commons.fileupload.jar from tomcat and classpath,

but the error is still there. Am I missing something?




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to