JVM/SpringBoot

Failed to determine a suitable driver class 오류 해결

헹창 2022. 4. 2.
반응형

오류 로그

*********************************
APPLICATION FAILED TO START
*********************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

 

원인

  • JDBC dependency를 추가한 상태에서 dataasource를 설정해주지 않아서 발생한 경우

해결방법

  • DB 구축이 되어 있지 않다면, 아래에 해당하는 의존성(dependency)을 제거한다.
// https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter
implementation group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '2.2.2'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jdbc
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '2.6.5'

 

  • DB 구축이 되어있다면 application.properties에 DB 설정정보를 아래와 같이 추가해준다.
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:this:@localhost:1521/xe
spring.datasource.username=admin
spring.datasource.passowrd=1234
728x90
반응형

댓글

추천 글