当前位置: 首页 > 知识库问答 >
问题:

启动Spring Boot应用程序时liquibase出现问题

厍浩广
2023-03-14

我有一个Spring Boot应用程序与liquibase,我第一次创建表没有问题,但当我再次启动它时,我有一个我无法解决的问题。

这是错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-03-21 12:22:27.294 ERROR 8828 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1153) ~[spring-context-5.3.4.jar:5.3.4]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:907) ~[spring-context-5.3.4.jar:5.3.4]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582) ~[spring-context-5.3.4.jar:5.3.4]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.3.jar:2.4.3]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.3.jar:2.4.3]
    at com.dulcesproyect.server.DulcesServerApplication.main(DulcesServerApplication.java:15) ~[classes/:na]
Caused by: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')
    at liquibase.changelog.StandardChangeLogHistoryService.getRanChangeSets(StandardChangeLogHistoryService.java:328) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.changelog.AbstractChangeLogHistoryService.upgradeChecksums(AbstractChangeLogHistoryService.java:66) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.changelog.StandardChangeLogHistoryService.upgradeChecksums(StandardChangeLogHistoryService.java:297) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1174) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.Liquibase.update(Liquibase.java:192) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.Liquibase.update(Liquibase.java:178) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:368) ~[liquibase-core-3.10.3.jar:na]
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:316) ~[liquibase-core-3.10.3.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[spring-beans-5.3.4.jar:5.3.4]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-5.3.4.jar:5.3.4]
    ... 19 common frames omitted

我尝试了以下方法,但未能解决问题:

-

-

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>8.0.22</version>
</dependency>

-

但我试过的方法都没有解决这个问题。我如何解决这个问题才能顺利启动应用程序?

共有1个答案

澹台正真
2023-03-14

这是Spring Boot 2.4.3的一个已知问题。过来看:https://github.com/liquibase/liquibase/issues/1639

您可以使用Spring Boot 2.4.2(我就是这么做的),也可以将Liquibase更新到4.3.1版。

<!-- https://mvnrepository.com/artifact/org.liquibase/liquibase-core -->
<dependency>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-core</artifactId>
    <version>4.3.1</version>
</dependency>
 类似资料:
  • 所以我使用IntelliJ,并使用JavaFX构建了我的应用程序。但当我开始我的主要工作时: 我得到以下错误,我不知道这些错误来自哪里。。。在我切换github上的分支并重新设置所有配置之前,一切都很正常。。。 我得到的错误:

  • 当启动Confluence插件时,我总是得到以下错误: 我已经尝试了几个插件和Windows,Mac和Ubuntu。不幸的是,我总是在启动当前和旧的SDK时遇到这个错误。我已经尝试了Oracle和OpenJdk,都是版本8。结果是一个404页面时调用http://127.0.0.1:1990/confluence 我的环境 Tomcat日志不包含任何错误。。。 你有同样的问题吗,或者你知道解决方法

  • 我在stackoverflow上发现了类似的问题,并试图用这种方式(LINK)解决这个问题,但在我的项目中没有起作用。谁能给我一些建议吗? pom.xml 应用属性

  • 我正试图用Tomcat7运行我的webapp,但我遇到了这个例外: Grave:Excepción arrancando filtro Wicket.Filter java.lang.IllegalStateException:在org.apache.Wicket.Spring.SpringWebApplicationFactory.createApplication(SpringWebAppli

  • 我在启动嵌入式tomcat服务器后,在我的Spring启动应用程序中添加了Java旋律配置,我得到了以下错误: 应用程序无法启动 描述: 应用程序上下文中的5个bean之间存在循环依赖关系: activeOrderController(字段私有om.gov.moh.nehr.service.ActiveOrderServiceom.gov.moh.nehr.controller.ActiveOrd

  • 使用spring-boot时,一切工作都很好。尽管如此,在spring-boot中已删除了注释和。我试图将代码重构为新版本,但我做不到。对于以下测试,我的应用程序在测试之前没有启动,http://localhost:8080返回404: 如何重构测试以使其在Spring-Boot1.5中工作?