Spring Boot SQLite运行编译错误

时间:2018-08-11 18:44:38

标签: java spring sqlite spring-boot

我在jar弹簧靴的编译中遇到问题,该项目可以在eclipse中运行,但是在使用java -jar等命令打开该项目时却没有。

数据库为SQLite和Spring Boot 2.0.0M

错误堆栈:

'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 org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
        2018-08-11 15:20:24.596  INFO 28318 --- [           main] ConditionEvaluationReportLoggingListener : 

说明:

无法配置数据源:未指定'url'属性,并且无法配置任何嵌入式数据源。

原因:无法确定合适的驱动程序类别

properties.yml:

spring:
  datasource: 
    driver-class-name: org.sqlite.JDBC
    url: jdbc:sqlite:com.geoscanner.util.bounds.db
    username: 
    password: 
jpa: 
   database-platform: com.geoscanner.util.SQLiteDialect
   hibernate.ddl-auto: none
   generate-ddl: false
   show-sql: true
mvc:
  dispatch-options-request: true

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.geoscanner</groupId>
<artifactId>GeoScanner</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>GeoScanner</name>
<description>GeoScanner</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.4.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </exclusion>
    </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.23.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.zsoltfabok/sqlite-dialect -->
    <dependency>
        <groupId>com.zsoltfabok</groupId>
        <artifactId>sqlite-dialect</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>


<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

一如既往地感谢您的观看和回复。

0 个答案:

没有答案