현상 : Controller 테스트하기 위해 tomcat 서버를 올리고 테스트할때는 문제가 없지만, junit으로 controller 테스트할때 아래와같이 에러가 발생함.

error : java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I

원인 : javax.servlet-api의 버전이 맞지않아서 발생함.

처리 : 

AS_IS
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

TO_BE
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

+ Recent posts