关于spring:orgspringframeworkwebmultipartMultipartException

6次阅读

共计 1021 个字符,预计需要花费 3 分钟才能阅读完成。

问题:Request processing failed;nested exception is org.springframework.web.multipart.MultipartException

音讯 Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: 因为没有提供 multi-part 配置,无奈解决 parts

形容 服务器遇到一个意外的状况,阻止它实现申请。

在 application.xml 配置文件中加上 <multipart-config/>

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

        <multipart-config/>

        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:application.xml</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>
正文完
 0