简体   繁体   English

应用程序编译时出现springboot错误

[英]springboot error on the application compile

I have a problem with springboot after creating my springboot project.创建我的springboot项目后,我遇到了springboot的问题。 I filled out my application.properties to have access to the database.我填写了我的 application.properties 以访问数据库。 And then I tried to compile by maven and I encountered these errors.然后我尝试通过 maven 编译,我遇到了这些错误。 I was unsuccessful.我没有成功。

 ##DataSource settings spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/BD_GESTION_OPERATION?createDatabaseIfNotExist=true&userSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC spring.datasource.username=system spring.datasoutce.password= spring.datasource.driver-class-name=com.oracle.jdbc.Driver ##Keep the connection alive if idle for a long time (needed in production) spring.datasource.testWhileIdle=true spring.datasource.validationQuery=SELECT 1 ##Disabling spring basic security security.basic.enabled=false ##Start up port server.port=8082 ##Specify DBMS spring.jpa.database=ORACLE ##Show/Hide SQL queries spring.jpa.show-sql=false ##Hibernate DDL Auto (create, create-drop, update) spring.jpa.hibernate.ddl-auto=update ##Naming strategy spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.ImprovedNamingStrategy ##Dialect spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle11gDialect

 The errors are as follows: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: java.lang.IllegalStateException: Cannot load driver class: com.oracle.jdbc.Driver java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: java.lang.IllegalStateException: Cannot load driver class: com.oracle.jdbc.Driver java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: 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: com.oracle.jdbc.Driver Caused by: java.lang.IllegalStateException: Cannot load driver class: com.oracle.jdbc.Driver

Seems to me you forgot to provide the dependency in maven在我看来,您忘记在 maven 中提供依赖项

<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc</artifactId>
        <version>8</version>
        <scope>system</scope>
        <systemPath>d:/projects/ojdbc8.jar</systemPath>
    </dependency>

Note that to get that working you need to download the jar file.请注意,要使其正常工作,您需要下载 jar 文件。 here is a quick explanation https://www.mkyong.com/jdbc/connect-to-oracle-db-via-jdbc-driver-java/这是一个快速解释https://www.mkyong.com/jdbc/connect-to-oracle-db-via-jdbc-driver-java/

Note Im asumming you are missing that but i did not look at your pom file注意我假设你错过了,但我没有查看你的 pom 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM