簡體   English   中英

無法確定數據庫類型NONE的嵌入式數據庫驅動程序類。 如果您想要嵌入式數據庫

[英]Cannot determine embedded database driver class for database type NONE. If you want an embedded database

我正在使用Spring Boot 1.5.10.RELEASE,Oracle數據庫12c,Gradle 4.6文件application.properties

server.port=8081
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.username=accounting
spring.datasource.password=123456
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect

文件build.gradle

buildscript {
    ext {
        springBootVersion = '1.5.10.RELEASE'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'

group = 'com.donhuvy'
version = '1.0.0-SNAPSHOT'
jar.archiveName = "spring_boot_oracle-1.0.0-SNAPSHOT.jar"
sourceCompatibility = 9

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-data-jpa') {
        exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
    }
    runtime('com.oracle:ojdbc7:12.1.0.1')
}

錯誤

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

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).


Process finished with exit code 1

雖然我想使用真實的數據庫服務器,但是Spring Boot想要嵌入數據庫,如何解決呢?

在我看來,您缺少oracle JDBC驅動程序的依賴項。 Spring Data JPA僅提供抽象。 您仍然需要單獨下載oracle JDBC驅動程序。 似乎它不在Maven存儲庫中。

嘗試點擊此鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM