mysql - Liquibase Spring error : Could not instantiate bean class [liquibase. integration.spring.SpringLiquibase]

标签 mysql spring liquibase

我正在尝试使用 Spring 运行 liquibase changeLog,如 docs 中所述,但出现以下错误:

Could not instantiate bean class [liquibase.integration.spring.SpringLiquibase]:Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError*

这是我的 applicationContext.xml:

<bean id="dataSourceLb" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/qacube" />
    <property name="user" value="root" />
    <property name="password" value="" />
    <!-- c3po -->
    <property name="initialPoolSize" value="5" />
    <property name="autoCommitOnClose" value="false" />
    <property name="idleConnectionTestPeriod" value="10" />
    <property name="testConnectionOnCheckin" value="true" />
    <property name="preferredTestQuery" value="SELECT 1" />
    <property name="maxPoolSize" value="100" />
    <property name="minPoolSize" value="5" />
</bean>        
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase" depends-on="dataSourceLb">
    <property name="dataSource" ref="dataSourceLb" />
    <property name="changeLog" value="classpath:mastertest.xml" />
</bean>

然后我将此依赖项添加到 pom.xml 中:

<dependency>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-core</artifactId>
    <version>3.2.0</version>
</dependency>

mastertest.xml 是有效的,它与 maven 一起运行,但我想让它与 Spring bean 一起运行。

这个配置有什么问题?

最佳答案

我将 changeLog 属性的值更改为“classpath:liquibase/mastertest.xml”,因为 mastertest.xml 位于 ProjectHome/src/main/resources/liquibase 文件夹中,并且它现在正在运行。

关于mysql - Liquibase Spring error : Could not instantiate bean class [liquibase. integration.spring.SpringLiquibase],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24755171/

相关文章:

php - 页面浏览量计数器在第一次页面调用时增加 +3(有时 +2),然后 +1,为什么?

java - UNCODE/espace 特殊字符 JSON 数据 Spring MVC

java - Liquibase 是否可以仅用于验证 ChangeSet 已应用但不实际执行它们?

oracle - ORA-01882:在Liquibase Gradle插件中找不到时区区域

hibernate - Flyway或Liquibase可以生成更新脚本而不是直接更新数据库吗?

php - Laravel - withCount 返回错误,提示 SQLSTATE[42S22] : Column not found: 1247 Reference 'cars_count' not supported (forward reference in item list)

MySql 在单个查询中插入多个值

java - 2 个配置文件,2 个方法实现,1 个通过 Thymeleaf 调用 html 文件。如何?

mysql - SQL条件if不存在

java - 如何将一个spring项目包含到另一个spring项目中