[Spring] web.xml 에러(error) 현상

2021. 4. 21. 10:38·Programing/Spring

Spring 세팅하는 와중에 에러 하나가 나를 계속 붙잡는다.

이 에러는 반드시 메모가 필요해 보여서 글을 남긴다.

현상은 web.xml에 servlet-name이 에러나 나타나는데, 이 에러 내용은 아래와 같다.
cvc-id.3: A field of identity constraint 'web-app-servlet-name-uniqueness' matched element 'web-app', but this element does not have a simple type.

구글 검색을 해봐도 나오는 내용이 같길래 한참을 해매고 나서야 에러해결은 했지만, 아직 정확한 원인은 잘 모르겠다.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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 https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/root-context.xml</param-value>
    </context-param>

    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Processes application requests -->
    <servlet>
        <!-- <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> -->
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet.class</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>



</web-app>

위의 코드는 web.xml에 코드 내용이다.

appServlet 이 부분이 에러가 나타나는 부분이다.

그래서 해결한 방법은 간단했다.

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 이부분을,
xsi:schemaLocation="http://JAVA.sun.com/xml/ns/javaee https://JAVA.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 이렇게 변경을 하고나니까 에러가 사라졌다.. 아직 정확히는 알지 못하므로 혹시나를 위해 메모를 남긴다.

'Programing > Spring' 카테고리의 다른 글

Spring MVC와 Spring Boot의 차이점 – 언제 무엇을 써야 할까?  (0) 2025.07.08
[Spring] 에러현상 조치  (0) 2021.04.29
[Spring] 스프링 특징  (0) 2021.04.22
[Spring] 프로젝트 구조  (0) 2021.04.21
[Spring] 개발 환경 세팅하기  (0) 2021.04.20
'Programing/Spring' 카테고리의 다른 글
  • [Spring] 에러현상 조치
  • [Spring] 스프링 특징
  • [Spring] 프로젝트 구조
  • [Spring] 개발 환경 세팅하기
에블‘s
에블‘s
  • 에블‘s
    에블
    에블‘s
  • 전체
    오늘
    어제
    • 분류 전체보기 (124) N
      • Programing (39)
        • JSP (3)
        • JAVA (24)
        • Spring (7)
        • HTML (5)
      • 이외 (15)
        • Git (5)
        • 임시 잡다함 (6)
        • IntelliJ (1)
        • 에러 모음 (2)
      • OS (31) N
        • Docker (6) N
        • Kubernetes (12) N
        • Linux (9)
        • DevOps (4)
      • DataBase (2)
        • Mysql (1)
      • 토이 프로젝트 (0)
        • 게시판 만들기 (0)
      • Spring (0)
      • 건강 & 생활 (18) N
        • 여름 건강 (18) N
      • 공부 · 자격증 (1)
      • 명언과 루틴 (3)
      • 부동산 or 주식 (8) N
        • 부동산 (6) N
        • 주식 (2)
      • 경제 (7)
  • 인기 글

  • 최근 글

  • 최근 댓글

  • 링크

    • 깃 허브 주소
  • 공지사항

  • 태그

    상속
    spring-framwork
    yaml
    kubernetes
    ubuntu
    spring
    IntelliJ
    MVC
    HTML
    Docker
    error
    데브옵스
    클래스
    Linux
    java
    개발환경
    DevOps
    jsp
    인프라관리
    쿠버네티스
  • hELLO· Designed By정상우.v4.10.3
에블‘s
[Spring] web.xml 에러(error) 현상
상단으로

티스토리툴바