Spring 오류 해결 방법 Unable to process parts as no multi-part configuration has been provided

반응형

Spring에서 게시판 작업중 파일 업로드를 하기 위해서 설정을 잡는 도중 에러가 났습니다.

파일 업로드를 하고 업로드를 누르면 오류가 났습니다.

 

원인

Unable to process parts as no multi-part configuration has been provided
구글번역 : 다중 부품 구성이 제공되지 않아 부품을 처리 할 수 없습니다.

 

"뭔 소리지?"

예상 이유

  1. servlet-context.xml 에서 오류가 나는 것 같은데 이유모르겠다(틀림)
  2. 컨트롤러나 jsp 파일 오류는 아닌 것 같은데(맞음)
  3. server 오류 (O)
여기서 에러가 났네요
3. Tomcat8 사용하는 경우 context.xml 미작성
<?xml version="1.0" encoding="UTF-8"?>
<Context allowCasualMultipartParsing="true" path="/">
    <Resources cachingAllowed="true" cacheMaxSize="100000" />
</Context>

출처: http://androphil.tistory.com/697 [소림사의 홍반장!]

 

하지만 Tomcat8의 context.xml은 어디냐...

servlet-context? root-context? 등등에 적용해보았으나 실패... 빨간줄이뜸
결국에는 여기 수정이 필요합니다

수정전

수정 후

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--><!-- The contents of this file will be loaded for each web application -->
<!-- 파일업로드 변경사항 -->
<Context allowCasualMultipartParsing="true" path="/">
    <Resources cachingAllowed="true" cacheMaxSize="100000" />
 
    <!-- Default set of monitored resources. If one of these changes, the    -->
    <!-- web application will be reloaded.                                   -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
 
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
 
    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
</Context>
cs

정상작동하네요.

톰캣버전이 8인 경우 멀티파트 파싱하려면 이렇게 설정을 변경해줘야 에러가 안뜨네요.
728x90
반응형