首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Spring Boot应用程序在升级到Apache Derby 10.15后中断--为什么?

Spring Boot应用程序在升级到Apache Derby 10.15后中断--为什么?
EN

Stack Overflow用户
提问于 2019-04-12 19:49:38
回答 2查看 90关注 0票数 1

在Spring Boot应用程序中的一轮SOUP升级期间,我将Apache Derby从10.14.1.0升级到了10.15.1.3。现在测试失败了,原因是(截断的、完整的堆栈跟踪here):

代码语言:javascript
运行
复制
Failed to load ApplicationContext
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
Caused by: org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'dataSource': 
        Invocation of init method failed
Caused by: java.lang.IllegalStateException: 
    Failed to replace DataSource with an embedded database for tests. 
    If you want an embedded database please put a supported one on the 
    classpath or tune the replace attribute of @AutoConfigureTestDatabase.

这是怎么回事?我需要更改任何配置吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-04-12 19:49:38

Apache Derby需要10.15.x中的Java 9,而Spring Boot目前不支持该版本。

另请参见spring-boot#16433

票数 1
EN

Stack Overflow用户

发布于 2021-04-02 20:33:51

我只想回答是什么让derby 15.2.0在Java 11之上的嵌入式模式下使用spring Boot 2.4.4与Spring Boot 2.4.4一起工作。Spring boot 2.4.4在Derby 14中开箱即用,尽管在spring boot启动时您会收到一些警告。将apache derby升级到15.2.0为我解决了这个问题。

在pom中,定义了derby和derbytools依赖关系:

代码语言:javascript
运行
复制
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derby</artifactId>
        <version>10.15.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbytools</artifactId>
        <version>10.15.2.0</version>
    </dependency>

然后在您的应用程序属性文件中:

spring.datasource.driver-class-name=org.apache.derby.iapi.jdbc.AutoloadedDriver

而不是: spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver

在那之后,我现在得到了Spring Boot的良好启动,没有任何警告或任何引起担忧的事情。

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

https://stackoverflow.com/questions/55650987

复制
相关文章

相似问题

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