728x90
오류->
The method getServletContext() is undefined for the type HttpServletRequest
원인은 HttpServletRequest 의 getServletContext() 함수는 Servlet 3.0 부터 지원되기때문이다
서블릿 3.0은 톰캣 7.0부터 지원된다는데 본인은 톰캣 8.5를 사용하는데도 에러가떴다. 이거 뭐지...?
해결책 두가지
1. <%= getServletContext().gerRealPath("/") %> 호출
or
2. pom.xml에 다음 dependency 추가
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
참고 : http://stackoverflow.com/questions/1979957/maven-dependency-for-servlet-3-0-api
Maven dependency for Servlet 3.0 API?
How can I tell Maven 2 to load the Servlet 3.0 API? I tried: javax.servlet servlet-api <versi...< p=""> </versi...<>
stackoverflow.com
'자주 뜨는 에러 모음집 👿' 카테고리의 다른 글
Unable to locate client connectivity software ora7nt.dll. (0) | 2021.07.09 |
---|---|
web.xml 오류 - there are '37' errors in 'jsp_2_1.xsd'. (0) | 2021.07.07 |
정말 화가 끝까지 나는 index.jsp / 404 not found 에러 (0) | 2021.06.28 |
댓글