반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 프로그래머스
- java
- 알고리즘
- 코딩
- array
- 콜백지옥
- 삼성소프트웨어아카데미
- AtoZ0403
- 삼성
- 코테
- stack
- NestJS
- 코테준비
- 그리디알고리즘
- 인프런
- 중간 평균값 구하기
- 자바스크립트
- 백준
- 스텍
- 자료구조
- 카카오
- 코딩테스트
- spring
- 자바
- mybatis
- SWEA
- javascript
- 배열
- 정렬
- js
Archives
- Today
- Total
개발에 AtoZ까지
[에러] Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; 예기치 않은 파일의 끝입니다. 본문
백엔드/Spring
[에러] Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; 예기치 않은 파일의 끝입니다.
AtoZ 개발자 2021. 5. 26. 20:04반응형
1. 현상
스프링부트 실행 시 아래와 같이 특정 Bean을 못 만들었다면서 서버가 정상적으로 구동되지 않는 에러가 발생했다.
2021-05-26 00:43:24 ERROR org.springframework.boot.SpringApplication[reportFailure:871] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'schedulerConfig': Unsatisfied dependency expressed through field 'schedulerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'schedulerServiceImpl': Unsatisfied dependency expressed through field 'schedulerRepository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'schedulerRepository' defined in file [C:\Users\Mr.K\Desktop\KSH\Programing\Project\ToyProject\Todo-App\Todo-server\bin\main\com\todo\app\mvc\repository\SchedulerRepository.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/todo/app/config/MybatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\Mr.K\Desktop\KSH\Programing\Project\ToyProject\Todo-App\Todo-server\bin\main\mapper\.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; 예기치 않은 파일의 끝입니다.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
at com.todo.app.TodoServerApplication.main(TodoServerApplication.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'schedulerServiceImpl': Unsatisfied dependency expressed through field 'schedulerRepository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'schedulerRepository' defined in file [C:\Users\Mr.K\Desktop\KSH\Programing\Project\ToyProject\Todo-App\Todo-server\bin\main\com\todo\app\mvc\repository\SchedulerRepository.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/todo/app/config/MybatisConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\Mr.K\Desktop\KSH\Programing\Project\ToyProject\Todo-App\Todo-server\bin\main\mapper\.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; 예기치 않은 파일의 끝입니다.
2. 해결방안
글쓴이는 에러 중 아래와 같은 에러만 보고 의존성주입에 해당되는 BEAN이 실제 객체화가 되지 못하여 발생했을 거라고 생각하고 디버깅을 시도하였다.
Error creating bean with name 'schedulerConfig'
그런데 결과적으로는 다른 이유에 있었다. 원인은 xml 파일을 읽는데 실패했다는 것이였다.
nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\Mr.K\Desktop\KSH\Programing\Project\ToyProject\Todo-App\Todo-server\bin\main\mapper\.xml]';
그래서 파일 전체 검색을 해봤는데 작업하면서 실수로 .xml 파일을 만들어 놨었던 것이 문제였다. 하지만... project explorer에는 안보였음...ㅎ 해당 프로젝트 로컬 디렉터리 가서 수동으로 삭제하고 나니깐 정상 구동됐다....ㅎㅎㅎ
반응형
'백엔드 > Spring' 카테고리의 다른 글
[에러]Database "mem:testdb" not found, either pre-create it or allow remote database creation (0) | 2021.07.19 |
---|---|
[Spring Boot] Gradle로 Build하는 방법 (0) | 2021.06.13 |
[Spring Boot] 전송방식에 따른 Parameter 받는 방법 (1) | 2021.04.30 |
[Spring] 파일 단일/다중 업로드(Multipart) (0) | 2021.01.23 |
H2, JPA, MyBatis 특징 및 차이 (0) | 2021.01.17 |
[Spring] Mybatis 와 JPA 환경설정 차이 (0) | 2021.01.17 |
Comments