관리 메뉴

취미개발 블로그와 마음수양

스프링 부트 파일 업로드 에러 The temporary upload location [] is not valid 본문

FrameWork_ETC/Spring

스프링 부트 파일 업로드 에러 The temporary upload location [] is not valid

아라한사 2018. 1. 22. 15:19

이런 에러가 나뿐만 아니라 여러 사람이 겪은 듯 하다


Could not parse multipart servlet request; nested exception is java.io.IOException:

The temporary upload location [/tmp/tomcat.6535258306400012745.5000/work/Tomcat/localhost/ROOT] is not valid




여러 사람

https://github.com/JakduK/jakduk-api/issues/276

http://java.ihoney.pe.kr/489


이슈 쓰레드 


https://github.com/spring-projects/spring-boot/issues/9616


해결책

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"