You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by dshivhare <sh...@gmail.com> on 2007/04/11 07:23:37 UTC

I am getting an error : java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V

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?


-- 
View this message in context: http://www.nabble.com/I-am-getting-an-error-%3A-java.lang.NoSuchMethodError%3A-org.apache.commons.fileupload.FileUpload.setSizeMax%28I%29V-tf3557383.html#a9933379
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: I am getting an error : java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V

Posted by Laurie Harper <la...@holoweb.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org