Caused by: java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver

·2023년 11월 8일
0

오류

목록 보기
2/10

오류
Caused by: java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myController': Unsatisfied dependency expressed through field 'userDAO'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myUserDAO': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.24.jar:5.3.24]

springboot에서 jdbctemplate을 사용하려 하는데 ojdbc6.jar 파일이 없어서 나는 오류임

*해결방법
프로젝트 우클릭 -> Build Path -> Configure Build Path 하면 사진과 같은 창이 뜬다.

여기서 Librareis에서 ClassPath를 선택한 후 Add External Jars..를 선택해 본인이 설치한 oracle폴더 안에 있는 ojdbc6.jar파일을 가져오도록 한다.

ojdbc6.jar파일 임포트해서 오류 해결

profile
냐홍

0개의 댓글