Liquibase Spring错误:无法实例化bean类[liquibase.integration.spring.SpringLiquibase]

时间:2014-07-15 09:57:37

标签: mysql spring liquibase

我试图使用Spring运行liquibase changeLog,如docs中所述,但我收到以下错误:

  

无法实例化bean类[liquibase.integration.spring.SpringLiquibase]:构造函数抛出异常;嵌套异常是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一起运行。

此配置有什么问题?

1 个答案:

答案 0 :(得分:1)

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