Server

스프링 부트 파일 업로드 에러 Failed to parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException

lime37 2024. 5. 10. 16:58

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request procesption: Failed to parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. /tmp/tomcat.6245698fb13fe05_00000062.tmp (그런 파일이나 디렉터리가 없습니다)] with root cause


java.io.FileNotFoundException: /tmp/tomcat.6245698832114394963.8080/work/Tomcat/localhost/ROOT/upload_8103f650_6e95_4e3f_9382_e0a8fb13fe05_00000062.tmp (그런 파일이나 디렉터리가 없습니다)

 

해결책

1. 재부팅

2. 여기 댓글을 보면 될 듯 하다 

https://github.com/spring-projects/spring-boot/issues/5009#issuecomment-323646628

 

 

 

댓글 내용

Resurrecting a closed issue, but for anyone who might find it useful, I've used the following with great success (spring boot / elastic beanstalk).

It will exclude the /tmp/tomcat* directories for auto-cleanup.

 

# Prevent the tmpwatch cron job from deleting tomcat tmp files as this causes "Internal Server Errors"
# This script overwrites the existing file (which is backed up in the same directory as tmpwatch.bak)
# 
# Place this in the root of your project under .ebextensions/tmpwatch_cron.config.
# 
# If using elastic beanstalk and spring boot:
# 1) add this to your .ebextensions/ folder with the provided name
# 2) ensure the .ebextensions folder is added as part of the zip that gets uploaded to elastic beanstalk 
#    (hint: maven-assembly-plugin to bundle as zip)
#
# see: https://github.com/spring-projects/spring-boot/issues/5009
files:
  "/etc/cron.daily/tmpwatch" :
    mode: "000755"
    owner: root
    group: root
    content: |
      #! /bin/sh
      flags=-umc
      /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
        -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
        -X '/tmp/hsperfdata_*' -X '/tmp/tomcat*' 10d /tmp
      /usr/sbin/tmpwatch "$flags" 30d /var/tmp
      for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
        if [ -d "$d" ]; then
          /usr/sbin/tmpwatch "$flags" -f 30d "$d"
        fi
      done

commands:
  01_tmpwatch_command:
    command: "touch /tmp/$(date '+%F.%T.%N').tmpwatch_cmd_01"

 

 

 

 

 

출처: https://adunhansa.tistory.com/209 [취미개발 블로그와 마음수양:티스토리]