java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?

异常信息:  2014-8-4 18:29:42 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet springServlet threw exception java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?

at org.springframework.util.Assert.notNull(Assert.java:112)

at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.resolveName(RequestParamMethodArgumentResolver.java:151)

at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:86)    ...

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Thread.java:662)

解决方法:

spring mvc中上传附件,需要做两步操作

1.引入包commons-fileupload-1.3.jar,版本号可以根据项目情况调整;

2.在spring mvc配置文件中增加配置,文件大小限制可根据项目情况调整:

<!-- 上传文件拦截,设置最大上传文件大小   10M=10*1024*1024(B)=10485760 bytes -->

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

<property name="maxUploadSize" value="10485760" />

</bean>

时间: 2024-09-30 06:37:33

java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?的相关文章

Expected MultipartHttpServletRequest: is a MultipartResolver configured

新增了一个表单上传功能 启动ide后,控制台报错 解决方案: 1.在spring_rest内增加 <!-- 支持上传文件 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/> 2.将  Commons FileUpload jar包加入lib中. 报错 org.apache.co

hadoop程序问题:java.lang.IllegalArgumentException: Wrong FS: hdfs:/ expected file:///

Java代码如下: FileSystem fs = FileSystem.get(conf); in = fs.open(new Path("hdfs://192.168.130.54:19000/user/hmail/output/part-00000")); 抛出异常如下: Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://192.168.130.54:

Hive报错 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D

报错信息如下 Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D 解决方法: 编辑 hive-site.xml 文件,添加下边的属性 <property> <name>system:java.io.tmpdir<

java.lang.IllegalArgumentException: Illegal character in query at index 261

在BaseFragment中使用了LoadingPage,而LoadingPage的联网加载使用的是AsyncHttpClient.一直报java.lang.IllegalArgumentException: Illegal character in query at index 261解析不成功,改成OkHttp解析即可. 网上有些方法,说先URLEncode再拼接,如果解决不了,换个联网请求方式,试一下.

解决Android studio 启动报错java.lang.RuntimeException: java.lang.IllegalArgumentException

报错内容 Internal error. Please report to https://code.google.com/p/android/issues java.lang.RuntimeException: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'name' of com/android/tools/idea/welcome/Platform.<init> must not be null 

java.lang.IllegalArgumentException: Service not registered

java.lang.IllegalArgumentException: Service not registered 首先检查一下,Service是否在AndroidManifest文件中注册.格式如下: <service   android:name=".MyService"  ></service> 如果Service已经注册了,还是会报这个错误的话,可能是 1.bindService没有成功,就直接unbindService: 2.也可能是已经unbind

java.lang.IllegalArgumentException: XXX is ambiguous in Mapped Statements collection

问题的出现: 在后台添加一个新栏目的时候,照着程序已有原来的代码添加新的功能时,文件没有错误.点击新的栏目的时候报了java.lang.IllegalArgumentException: selectPageByExample is ambiguous in Mapped Statements collection (try using the full name including the namespace, or rename one of the entries). 解决: 在网上查找了

java.lang.IllegalArgumentException: Document base E:\Eclipse\workspace\.metadata\.plugins\org.eclips

1.错误描述 四月 13, 2015 5:56:55 下午 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.7.0_67\bi

spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

出bug的原因:mybatis-spring版本问题. 查看SqlSessionDaoSupport源码 1.2以上的版本: 1.1.1版本: 解决方法:1.2版本移除了@Autowired的注解,所以如果是1.2版本以上,要在BaseDaoImpl里面手动 注入SetSessionTemplate或者SetSessionFactory spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property 'sqlSessionFa