Multifile upload problem with no attached fles

Multifile upload problem with no attached fles

I'm having a problem using the MultiFile plugin with Spring MVC. It works fine when one or
more files are attached; however, it fails when no files are attached.  From Firebug the request is:

  1. -----------------------------23805158906729 Content-Disposition: form-data; name="ksUrlId" 5 -----------------------------23805158906729 Content-Disposition: form-data; name="ksUrl" http://localhost:8080/sadlserver-cxf-service-1.0.3/SadlService -----------------------------23805158906729 Content-Disposition: form-data; name="serviceName" InScope-CFM56-7 -----------------------------23805158906729 Content-Disposition: form-data; name="file" -----------------------------23805158906729 Content-Disposition: form-data; name="savedQueryId" 3 -----------------------------23805158906729 Content-Disposition: form-data; name="query" select ?cw where {<Transfer_Gearbox_Module-111111> <candidate_Workscope> ?cw } -----------------------------23805158906729 Content-Disposition: form-data; name="queryName" -----------------------------23805158906729--
The request headers are:

  1. Connection close Content-Length 1000 Content-Type text/html;charset=utf-8 Date Fri, 20 Jul 2012 00:06:26 GMT Server Apache-Coyote/1.1 Request Headers Accept application/json, text/javascript, */*; q=0.01 Accept-Encoding gzip, deflate Accept-Language en-us,en;q=0.5 Connection keep-alive Content-Length 888 Content-Type multipart/form-data; boundary=---------------------------23805158906729 Host localhost:8080 Referer http://localhost:8080/queryserver-1.0.1/ User-Agent Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1 X-Requested-With XMLHttpRequest

In Spring the method that should get invoked is:

  1.  public @ResponseBody ExecuteQueryResult executeQuery( @RequestParam("ksUrl") String ksUrl, @RequestParam("serviceName") String serviceName, @RequestParam(value="file",required=false) MultipartFile[] file, @RequestParam("query") String query, HttpServletResponse response) {
however, the errors I get are:

  1. 2012-07-20 10:19:54,475 DEBUG [org.springframework.web.servlet.DispatcherServlet] [http-bio-8080-exec-10] DispatcherServlet with name 'appServlet' processing POST request for [/queryserver-1.0.1/execute-query] 2012-07-20 10:19:54,506 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerMethodMapping] [http-bio-8080-exec-10] Looking up handler method for path /execute-query 2012-07-20 10:19:54,506 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerMethodMapping] [http-bio-8080-exec-10] Returning handler method [public com.ge.research.sadl.queryserver.webapp.controller.ExecuteQueryResult com.ge.research.sadl.queryserver.webapp.controller.QueryController.executeQuery(java.lang.String,java.lang.String,org.springframework.web.multipart.MultipartFile[],java.lang.String,javax.servlet.http.HttpServletResponse)] 2012-07-20 10:19:54,506 DEBUG [org.springframework.beans.factory.support.AbstractBeanFactory] [http-bio-8080-exec-10] Returning cached instance of singleton bean 'queryController' 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initializing new StandardEnvironment 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemProperties] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemEnvironment] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initializing new StandardEnvironment 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemProperties] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemEnvironment] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initializing new StandardEnvironment 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemProperties] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemEnvironment] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initializing new StandardEnvironment 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemProperties] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemEnvironment] PropertySource with lowest search precedence 2012-07-20 10:19:54,506 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2012-07-20 10:19:54,522 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initializing new StandardEnvironment 2012-07-20 10:19:54,522 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemProperties] PropertySource with lowest search precedence 2012-07-20 10:19:54,522 DEBUG [org.springframework.core.env.MutablePropertySources] [http-bio-8080-exec-10] Adding [systemEnvironment] PropertySource with lowest search precedence 2012-07-20 10:19:54,522 DEBUG [org.springframework.core.env.AbstractEnvironment] [http-bio-8080-exec-10] Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2012-07-20 10:19:54,522 DEBUG [org.springframework.beans.BeanUtils] [http-bio-8080-exec-10] No property editor [org.springframework.web.multipart.MultipartFileEditor] found for type org.springframework.web.multipart.MultipartFile according to 'Editor' suffix convention 2012-07-20 10:19:54,522 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver] [http-bio-8080-exec-10] Resolving exception from handler [public com.ge.research.sadl.queryserver.webapp.controller.ExecuteQueryResult com.ge.research.sadl.queryserver.webapp.controller.QueryController.executeQuery(java.lang.String,java.lang.String,org.springframework.web.multipart.MultipartFile[],java.lang.String,javax.servlet.http.HttpServletResponse)]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile[]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.web.multipart.MultipartFile]: no matching editors or conversion strategy found 2012-07-20 10:19:54,522 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver] [http-bio-8080-exec-10] Resolving exception from handler [public com.ge.research.sadl.queryserver.webapp.controller.ExecuteQueryResult com.ge.research.sadl.queryserver.webapp.controller.QueryController.executeQuery(java.lang.String,java.lang.String,org.springframework.web.multipart.MultipartFile[],java.lang.String,javax.servlet.http.HttpServletResponse)]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile[]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.web.multipart.MultipartFile]: no matching editors or conversion strategy found 2012-07-20 10:19:54,522 DEBUG [org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver] [http-bio-8080-exec-10] Resolving exception from handler [public com.ge.research.sadl.queryserver.webapp.controller.ExecuteQueryResult com.ge.research.sadl.queryserver.webapp.controller.QueryController.executeQuery(java.lang.String,java.lang.String,org.springframework.web.multipart.MultipartFile[],java.lang.String,javax.servlet.http.HttpServletResponse)]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'org.springframework.web.multipart.MultipartFile[]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.web.multipart.MultipartFile]: no matching editors or conversion strategy found 2012-07-20 10:19:54,522 DEBUG [org.springframework.web.servlet.DispatcherServlet] [http-bio-8080-exec-10] Null ModelAndView returned to DispatcherServlet with name 'appServlet': assuming HandlerAdapter completed request handling 2012-07-20 10:19:54,522 DEBUG [org.springframework.web.servlet.FrameworkServlet] [http-bio-8080-exec-10] Successfully completed request




Any ideas what the problem is?
Thanks is advance.

Barry