Spring + MySql 연결중 생긴 오류 원인과 해결 ERROR 34800, ERROR 33836, pom.xml 오류 등

박해인·2022년 12월 4일
2

Spring과 mysql을 연동하는 과정에서 많은 오류를 겪었다.😣

오류 ①
pom.xml가 없는 경우
오류 ②
pom.xml 오류
오류 ③
Mysql 연결 오류
오류 ④
sql문 오류

오류 ① pom.xml 이 없는 경우

MyBatis와 Mysql dependecy를 추가하려하는데 pom.xml이 없다 😟
∵ 초기에 maven 프로젝트로 작업하지하지 않았다.
✔️ 프로젝트를 maven 프로젝트로 전환해준다. => pom.xml 파일 생성된다.

오류 ② pom.xml 오류

①을 해결하고 pom.xml에 dependency를 추가하니 아래와 같은 오류가 떴다.

Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): No connector factories available

∵ ①에서 프로젝트를 maven 프로젝트로 전환하는 과정에서 maven파일 install이 정상적으로 이루어지지 않은 것 같다.
✔️ 프로젝트>우클릭>Maven>Update Project>Force update of snapshots/Release 체크해주기


오류 ③ DB 연결 오류

ERROR 34800 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.mybatis.spring.MyBatisSystemException] with root cause

✔️ application.properties 에서 Mysql 계정과 비밀번호가 제대로 입력되었는지 확인해보시오

오류 ④ sql문 오류

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 

✔️ mapper에 입력한 sql문에 문제가 없는지 확인해 보시오

profile
갓생살고싶어라

0개의 댓글