본문으로 바로가기

에러 로그를 살펴볼때 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1355)

The following method did not exist:

    javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;

The method's class, javax.servlet.ServletContext, is available from the following locations:

    jar:file:/C:/Users/User/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar!/javax/servlet/ServletContext.class
    jar:file:/C:/Users/User/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.41/tomcat-embed-core-9.0.41.jar!/javax/servlet/ServletContext.class

The class hierarchy was loaded from the following locations:

    javax.servlet.ServletContext: file:/C:/Users/User/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext

 

위와 같은 에러가 나왔다면 해당 에러는 servlet-api 2.4 버전이 너무 낮다는 뜻이다. 

javax.servlet.ServletContext.getVirtualServerName() 메소드는 3.1 버전에서 추가되었으므로 나는 에러이다. 

maven 설정을 사용한다면

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

위와 같이 추가 해서 해당 라이브러리에 대한 의존성을 제거해주도록 하자.