spring mvc 上传时
org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
解决方法
添加配置:
- <bean id="multipartResolver"
- class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <!-- set the max upload size100MB -->
- <property name="maxUploadSize">
- <value>104857600</value>
- </property>
- <property name="maxInMemorySize">
- <value>4096</value>
- </property>
- </bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- set the max upload size100MB --> <property name="maxUploadSize"> <value>104857600</value> </property> <property name="maxInMemorySize"> <value>4096</value> </property> </bean>
问题解决.
简单分析:
当Web请求到达DispatcherServlet并等待处理的时候,DispatcherServlet首先会检查能否从自己的WebApplicationContext中找到一个名称为multipartResolver(由DispatcherServet的MULTIPART_RESOLVER_BEAN_NAME决定)实例.如果能获得这个实例,DispatcherServlet将通过MultipartResolver的isMultipart(request)方法检查当前Web请求是否为multipart类型.如果是,DispatcherServlet将调用MultipartResolver的resolveMultipart(request)方法,返回MultipartHttpServletRequest,否则返回HttpServletRequest.
SpringMVC为MultipartResolver提供了两个实现类,org.springframework.web.multipart.commons.CommonsMultipartResolver使用apache的commons fileupload实现,org.springframework.web.multipart.cos.CosMultipartResolver使用Oreilly Cos实现,因此必须选择这两个实现类中的一个,然后添加到DispatcherServlet的WebApplicationContext,例如如果使用commons upload则添加上面的代码到XML,这样CommonsMultipartResolver/CosMultipartResolver将负责分析当前multipart的请求.
相关推荐
问题1:TOMCAT下载文件出错:org.apache.catalina.connector.ClientAbortException. 问题2:TOMCAT记录接收数据大小、发送数据大小和请求处理时间
org.apache.catalina.core.AprLifecycleListener myeclipse tomcat 無法啟動 用這個文件
jar包,官方版本,自测可用
2010-8-11 18:24:13 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the ...
3月 17, 2019 10:51:41 上午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/7.0.78 3月 17, 2019 10:51:41 上午 org.apache.catalina.startup.VersionLoggerListener...
jar包,官方版本,自测可用
严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Error-附件资源
apache-tomcat软件,windows-64版本 日志可查看catalina.out,如下: at org.springframework.web.servlet.mvc.method.annotation... at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
nginx过滤器不推荐使用 org.apache.catalina.valves.RemoteIpValve 代替。 此项目将永远不会再更新。 ============ java web应用的过滤器,通常可以配置全局服务器。 <filter> <filter>NginxFilter</filter> ...
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote....
apache-tomcat-8.5.78 源码 maven 版本,配置都已经搞定,开箱即用。是学习tomcat的不二之选。启动类 org.apache.catalina.startup.Bootstrap
2009-8-29 14:02:04 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 ...
这个过程由Apache Tomcat服务器执行,一个流行的Java Servlet容器。然而,部署过程中遇到了问题,特别是与`blog`应用程序相关的错误。 错误发生在尝试配置应用程序监听器时,监听器类为`org.springframework.web....
1. **下载CorsFilter**:根据描述,你需要的文件是"tomcat跨域jar文包件",这个文件通常包含`org.apache.catalina.filters.CorsFilter`类,这是Tomcat自带的CORS过滤器实现。你可以从Apache Tomcat的官方网站或者第...
org.apache.catalina org.apache.commons org.apache.coyote org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache....
org.apache.catalina org.apache.commons org.apache.coyote org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache....
org.apache.catalina org.apache.commons org.apache.coyote org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache....
org.apache.catalina org.apache.commons org.apache.coyote org.apache.ibatis org.apache.juli 4号包: org.apache.tiles org.apache.velocity org.apache.xerces org.apache.xml org.apache.xmlbeans org.apache....
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote....