본문 바로가기

DEV/JAVA

TOMCAT 8 getRealPath return null

반응형

이번에 톰캣 7에서 돌리던 프로젝트를 8에서 돌리게 되었다.

다른건 문제가 없었는데 기존에 잘되던 업로드가 안되었다.

getServletContext().getRealPath("resources/images/inquiryImageFile");

이부분에서 null 에러가 났다.

구글링을 해보니 해결책은

getServletContext().getRealPath("/resources/images/inquiryImageFile");

/붙여주니 잘돌아간다^^


출처 : http://stackoverflow.com/questions/25555541/getservletcontext-getrealpath-in-tomcat-8-returns-wrong-path


반응형