- 프로젝트를 실행했을때, 다음과 같은 오류가 발생했다
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-12-03T15:25:01.063+09:00 ERROR 48416 --- [project01] [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception with message: Failed to parse mapping resource: 'file [C:\Java\Project\NBE2-3-1-team2\build\resources\main\mappers\customer_mapper.xml]'
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657) ~[spring-beans-6.2.0.jar:6.2.0]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645) ~[spring-beans-6.2.0.jar:6.2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1351) ~[spring-beans-6.2.0.jar:6.2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181) ~[spring-beans-6.2.0.jar:6.2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563) ~[spring-beans-6.2.0.jar:6.2.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.2.0.jar:6.2.0]
- MaBatis에서는 Mapper XMl 파일의 namespace 속성이 인터페이스 이름과 정확하게 일치하여야 하는데 namespace 를 작성하지 않아서 발생하는 오류였다
<mapper namespace="com.example.project01.mapper.ProductMapper">
<select id="product_list" resultType="product">
select pid, img, name, cat, stk, price
from product
</select>
</mapper>
- 위와 같이 namespace를 추가해주니 동작하는 모습을 확인할 수 있었다.
'IntelliJ' 카테고리의 다른 글
[Error] Cause: java.sql.SQLSyntaxErrorException (1) | 2024.12.05 |
---|---|
[Project] 프로젝트 기획하기 (0) | 2024.12.03 |
[Server] REST/REST API/RESTful (0) | 2024.11.28 |
[Error] java.lang.NullPointerException (0) | 2024.11.27 |
[Error] The Unicode character [참] at code point (1) | 2024.11.26 |