스프링 프로젝트를 import 하거나 SVN에서 체크아웃 받은 후 환경설정 하다보면 아래와 같은 오류가 나온다.

 

[오류 내용]

maven java ee configuration problem(2 items)

- dynamic web module 3.1 requires java 1.7 or newer

- one or more constraints have not been satisfied



위 에러는 dynamic web module 3.1 로 설정이 되어있지만, Spring의 web.xml에 들어가는 Servlet Version 이 달라서 생기는 오류로 보인다.

 

[dynamic web module 버전 확인]

프로젝트 마우스 오른쪽 클릭 - Build Path - Configure Build Path - ProJect Facets - Dynamic Web Module 버전 확인

 

[Spring web.xml 확인]

dynamic web module 버전마다 Servlet Version이 다르므로 아래 내용 참조하여 수정하면 된다.

dynamic web module 버전이 3.1로 설정되어 있는 경우 

web-app_3_1.xsd" version="3.1" 로 변경한다.

 

Servlet 2.2

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app/>

Servlet 2.3

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app/>

Servlet 2.4 - DTD에서 Schema로 변경됨

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="servlet-2_4" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
</web-app>

Servlet 2.5

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="servlet-2_5"
	version="2.5">
</web-app>

Servlet 3.0

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	version="3.0">
</web-app>

Servlet 3.1

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	version="3.1">
</web-app>

Servlet 4.0

<?xml version="1.0" encoding="UTF-8"?>
<web-app
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
	version="4.0">
</web-app>

 

[참고 자료]

http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html

+ Recent posts