首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >弹簧引导依赖项错误级

弹簧引导依赖项错误级
EN

Stack Overflow用户
提问于 2016-05-20 14:18:15
回答 2查看 557关注 0票数 1

我有一个新的spring引导项目,并包含了一些依赖项。问题是,在第一次运行时,“rest”和“jpa”依赖关系工作得很好,但是在第二次运行时,我得到了一个巨大的错误。

代码语言:javascript
运行
复制
dependencies {
compile('org.springframework.boot:spring-boot-starter-cache')
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-remote-shell')
compile('org.springframework.boot:spring-boot-starter-social-facebook')
compile('org.springframework.boot:spring-boot-starter-social-twitter')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}

错误消息如下(它太大了,不能粘贴在这里):误差信息

我正在使用Intelij 2016.1.1

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-05-20 14:28:56

来自此堆栈跟踪的重要错误消息似乎是:

代码语言:javascript
运行
复制
Cannot determine embedded database driver class for database type NONE. 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)

它说,您没有定义要使用的数据库(它所在的位置是什么样的)。我想您需要向application.properties文件中添加一些属性,例如:

代码语言:javascript
运行
复制
spring.datasource.url = (URL to your data source)
spring.datasource.driverClassName = (fully qualified class name of your datasource driver)

您可以在内存数据库中使用H2:

代码语言:javascript
运行
复制
spring.datasource.url=jdbc:h2:mem:databaseName;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driverClassName=org.h2.Driver

请注意,您还需要将数据库的依赖项包含到您的Gradle依赖项中(compile('com.h2database:h2')用于H2)。

票数 3
EN

Stack Overflow用户

发布于 2016-05-20 14:32:23

对于这样的java错误,您可以看到有很多以Caused by:开头的行,这是因为在代码中有很多地方的代码捕获了一个异常,然后又抛出了它。

要找到真正的问题,您需要查看最后一个Caused by-entry:

代码语言:javascript
运行
复制
Cannot determine embedded database driver class for database type NONE. 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).

我不能说你所提供的信息本身是什么问题。但是在堆栈溢出处有处理此消息的其他一些线程

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37349111

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档