일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 페치조인
- Embeddable
- 관계형 데이터베이스
- Flush
- commit
- 영속성 컨텍스트
- 즉시로딩
- fetch join
- Spring
- ROLLBACK
- relational DB
- Amortized Analysis
- 값타입
- 정렬
- n+1문제
- DiscriminatorValue
- 지연로딩
- relational database
- 영속성전이
- 엔티티 매핑
- 순수jpa
- Spring Data JPA
- DiscriminatorColumn
- 고아객체
- Algorithm
- 플러시
- MappedSuperclass
- DB
- JPA
- 분할상환분석
- Today
- Total
Jun's note
[에러] org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart .. 본문
[에러] org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart ..
junning 2022. 11. 1. 18:29- 에러메시지:
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
- 문제상황:
'multipart boundary가 발견되지 않았다'는 뜻이다.
- 해결방법:
request 헤더의 content-type값에 boundary가 붙어서 요청되어야한다.
content-type: multipart/form-data; boundary=--------------------------191291234567841698989469
이런 형태가 되어야한다.
근본적인 문제는 그렇다.
내가 겪었던 문제는, React Native와 Spring이 협업할때 클라이언트쪽에서 content-type: multipart/form-data 을 설정해줄때 'boundary가 자동으로 추가되지 않아' 엄청난 고생을 했었다!!!!
거의 몇주동안 이것저것(네트워크 패킷까지 분석해보았다..) 해보다가 드디어... 원인을 알았다!!
혹여나 나와 비슷한 에러를 겪고있다는 조금이나마 도움이 되길 바라며 글을 적어본다.
-> 해결방법
React Native 디버거가 꺼져있는 상태에서 테스트해보자.
디버거가 꺼져있는 상태에서 테스트해보니, 자동으로 content-type에 boundary가 붙는 것을 확인할 수 있다.
추가로) React Native에서 데이터를 form data형식으로 보낼 때, 이미지를 {key:value} 형태로 form data 객체에 담는다.
이때 이미지를 담는 key이름을 잘 확인해보자.. 이는 React Native 공식 문서를 참고하면 좋을 것 같다.