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에 코드 내용이다.
그래서 해결한 방법은 간단했다.
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] 에러현상 조치 (0) | 2021.04.29 |
---|---|
[Spring] 스프링 특징 (0) | 2021.04.22 |
[Spring] 프로젝트 구조 (0) | 2021.04.21 |
[Spring] 개발 환경 세팅하기 (0) | 2021.04.20 |