eGovFrame 표준프레임워크 포털

메뉴 건너띄기
상단메뉴 바로가기
본문 바로가기

이 누리집은 대한민국 공식 전자정부 누리집입니다.

본문 영역

적용 지원, FAQ, Q&A 게시판을 통해 기술 문제 해결을 지원합니다.

묻고 답하기

mysql연동 오류
  • 작성자

    홍*

  • 작성일

    2023-09-20 02:39:52

  • 조회수

    1,527

  • 구분

    실행환경 / 3.9

  • 진행상태

    완료

질문

원래 mybatis-config에 typeAlias를 지정해놓고 Mapper 작성해서 테스트 중이었습니다. 오류가 발생해 mapper쪽 문제일 수 있다해서 mapper 싹 지우니 서버가 정상적으로 돌아가더라구요. 그래서 mapper 문제인 같은데 혹시 저 mapper에서 뭐가 문제인지 봐주실 수 있을까요?
db 테이블은 name, id는 varchar, id int인 상황입니다.

오류정보
WARN : org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testDAOMyBatis': Unsatisfied dependency expressed through field 'sqlSession'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSession' defined in spring.conf.SpringConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.mybatis.spring.SqlSessionTemplate]: Factory method 'sqlSession' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in spring.conf.SpringConfiguration: 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: 'class path resource [com/myMbti/dao/testMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'class path resource [com/myMbti/dao/testMapper.xml]'. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for testSQL.getItems. please check com/myMbti/dao/testMapper.xml and class path resource [com/myMbti/dao/testMapper.xml]

환경정보
    - OS 정보 : windos
    - 표준프레임워크 버전 : 5.0.7.RELEASE
    - JDK(JRE) 정보 : javase-11
    - WAS 정보 :
    - DB 정보 : amazon RDS mysql
    - 기타 환경 정보 :
첨부파일
답변

안녕하세요.
표준프레임워크센터입니다.

UnsatisfiedDependencyException 오류는
의존성 주입이 제대로 이루어지지 않았을 때 발생하므로
Bean 설정이나 각 단계에서의 의존성 주입 등을
확인해보시기 바랍니다.

MyBatis Mapper 설정은 아래 링크에서 확인할 수 있으니
참고하시기 바랍니다.
https://mybatis.org/mybatis-3/ko/configuration.html#properties

감사합니다.
 

이 페이지의 구성

묻고 답하기