hyeonga_code

Spring Boot_JPA_persistence.xml 오류 해결 [cvc-elt.1.a: Cannot find the declaration of element 'persistence'.] 본문

IT 소개념/오류 해결

Spring Boot_JPA_persistence.xml 오류 해결 [cvc-elt.1.a: Cannot find the declaration of element 'persistence'.]

hyeonga 2023. 10. 25. 10:00
반응형

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<!-- window > preferences > Maven > Download Artifact Javadoc 체크 > apply -->
<persistence version="2.2" xmlns="httpa://xmlns.jcp.org/xml/ns/persistence" 
    xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 
                        http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
 
     <!-- 
         - xmlns:xsi
             - xsi : XML 스키마 정의를 위한 네임스페이스입니다.
                 - XML 문서의 유효성 검증을 위해 사용됩니다.
      -->
     
     <persistence-unit name="ch04">
        <class>tommy.spring.domain.Board</class>
    </persistence-unit>
</persistence>
 



- 그래도 오류 발생하는 경우 수동으로 파일을 저장해야 합니다.

'C:\Users\hyeon\.lemminx\cache\http\xmlns.jcp.org\xml\ns\persistence'
> C 드라이브 > 사용자 > '사용자 계정' > .lemminx > cache > http > xmlns.jcp.org > xml > ns
     - 나의 경우 ns 폴더 내에 persistence 파일만 있고 폴더가 없는 상태
     - 혹시 모르므로 persistence 파일을 다른 곳에 옮겨두고 persistence 폴더를 생성
     - persistence 폴더 안에 persistence 파일을 붙여넣음
     - 구글에서 'persistence_2_2.xsd'를 검색하여 다운로드 (오라클)

 

https://www.google.com/url?cad=rja&cd=&esrc=s&opi=89978449&q=&rct=j&sa=t&source=web&uact=8&url=https%3A%2F%2Fwww.oracle.com%2Fwebfolder%2Ftechnetwork%2Fjsc%2Fxml%2Fns%2Fpersistence%2Fpersistence_2_2.xsd&usg=AOvVaw0ws1XpB9p3Ke3GP374Y18W&ved=2ahUKEwjHh5qv1I2CAxXOiFYBHfdmAvkQFnoECAsQAQ

 

www.google.com



    - 다운받은 파일도 persistence 폴더 안으로 이동한 뒤 프로젝트 maven update하니까 오류가 사라짐






































 

반응형