티스토리 뷰

반응형

Spring Boot(스프링부트)에서 ClassPathResource을 이용하여 jar 파일 내부에서 있는 파일을 읽어오도록 개발을 했는데 노트북에서는 이상없이 작동하는데.. 서버에만 배포를 하면 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.nio.file.FileSystemNotFoundException] with root cause 오류가 계속해서 발생했다.

오류 원인을 열심히 찾아 보니 스프링부트와 같이 war, jar 파일 내부에 있을 경우에는 toFile() 같은 것을 사용하지 말고 inputStream 같은 것을 사용하라고 이야기가 나왔다.

별거 아니지만 거의 반나절이 없어졌다.

stackoverflow.com/questions/25869428/classpath-resource-not-found-when-running-as-jar

 

Classpath resource not found when running as jar

Having this problem both in Spring Boot 1.1.5 and 1.1.6 - I'm loading a classpath resource using an @Value annotation, which works just fine when I run the application from within STS (3.6.0, Windo...

stackoverflow.com

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함