我正在尝试使用 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/