Did you try to test with version prior to 2.3.7?
Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/1/14 Philippe Lagardere <philippe.lagard...@gmail.com>: > Hello, > > I've been trying to set up a form to upload a .txt file to the server, > and met a curious exception doing so. The exception implies Struts > expects the setter method to use a String array instead of a > java.io.File. Not that it would have been acceptable, but adding a > setter using a string array does not change anything (same exception > stack). > The action method itself is never reached, since the exception is > seemingly thrown during the ParametersInterceptor.doIntercept() > method. > > I had a similar exception a couple of months ago, due to conversion > problems, since then solved by overriding Number and Date converters. > It is probably just a coincidence though - I can't see why type > conversion would relate here. > > Here are some informations regarding the context. > > [Form] > > <s:form action="entreprise_charger_fichier" method="POST" > enctype="multipart/form-data"> > <s:file name="upload" label="Parcourir" accept="text/plain" /> > <s:submit value="Valider" /> > </s:form> > > [Action declaration in struts.xml] - nothing fancy here > > <action name="entreprise_charger_fichier" > class="fr.insee.resane.pro.ihm.controleur.actions.DossiersEntrepriseAction" > method="chargerFichier"> > <result name="input" type="redirectAction">entreprise</result> > <result type="redirectAction">entreprise</result> > </action> > > [Miscellaneous information] > > Interceptor stack is the default stack, with a couple custom > interceptors (the request goes through one, but the others aren't > reached). > > The action class (DossiersEntrepriseAction) does have a field named > "upload", which is a java.io.File (as seen here : > http://struts.apache.org/2.3.8/docs/file-upload.html). The getter and > setter methods exist, but obviously they use or return a File, not a > String array. > > Commons-IO and Commons-FileUpload are in the classpath, fetched as > transitive dependencies of the struts-core-2.3.8 artifact. > > The problem also appears with Struts 2.3.7. > > > [Stack trace] - I trimmed it a bit but it's still not that edible, sorry > > ognl.MethodFailedException: Method "setUpload" failed for object > fr.insee.resane.pro.ihm.controleur.actions.DossiersEntrepriseAction@1c803ae > [java.lang.NoSuchMethodException: > fr.insee.resane.pro.ihm.controleur.actions.DossiersEntrepriseAction.setUpload([Ljava.lang.String;)] > at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1246) > at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1494) > at > ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) > at > ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) > at > com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27) > at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2332) > at > com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:78) > at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2332) > at ognl.ASTProperty.setValueBody(ASTProperty.java:127) > at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) > at ognl.SimpleNode.setValue(SimpleNode.java:301) > at ognl.Ognl.setValue(Ognl.java:737) > at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:218) > at > com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:187) > at > com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:174) > at > com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:152) > at > com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:318) > at > com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:230) > at > com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) > at > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242) > at > com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:238) > at > com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) > [INTERCEPTORS IN THE DEFAULT STACK KICK IN] > [SERVER RELATED STUFF, CUSTOM INTERCEPTOR] > > It is possible I missed something when setting up my classes/action, > but I can't find anything when double-checking. > At any rate, this doesn't explain why Struts (or OGNL) is asking for a > String[] at that point. I understand that strings are the standard way > to transfer data from a browser, but I can't see how it could apply to > file uploading. > > Thank you in advance for your input, > > PL > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org