2

Here is the Derby EmbeddedXADataSource configuration for Spring Boot Application using Bitronix Transaction Manager

package org.chorke.init.entity.config;

import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import bitronix.tm.resource.jdbc.PoolingDataSource;

@Configuration
@EnableTransactionManagement
public class BitronixConfiguration {

    @Bean(initMethod = "init", destroyMethod = "close")
    public DataSource dataSource() {
        PoolingDataSource dataSource = new PoolingDataSource();
        dataSource.setMaxPoolSize(10);
        dataSource.setUniqueName("java:jboss/datasources/CKDerby_initDS");
        dataSource.setClassName("org.apache.derby.jdbc.EmbeddedXADataSource");
        dataSource.setAllowLocalTransactions(true);
        dataSource.getDriverProperties().setProperty("user", "chorke_init");
        dataSource.getDriverProperties().setProperty("password", "pa55w0rd");
        dataSource.getDriverProperties().setProperty("createDatabase", "create");
        dataSource.getDriverProperties().setProperty("databaseName", "/tmp/chorke_osuser/var/derby/init/chorke_init;shutdown=false");
        return dataSource;
    }
}

Liquibase configuration for Spring Boot Application

################################################################################
# application.properties
################################################################################
liquibase.change-log=classpath:/META-INF/migrations/db.changelog-master.xml
spring.main.show-banner: false
spring.profiles.active: test

After launch the Spring Boot Application, Liquibase performed update operation successfully where either Liquibase or Derby itself shutting down the Derby connection as following:

INFO 11/15/17 10:55 PM: liquibase: Successfully released change log lock
INFO 11/15/17 10:55 PM: liquibase: Shutting down derby connection: jdbc:derby:/tmp/chorke_osuser/var/derby/init/chorke_init;shutdown=true

Causes application failure due to the Derby connection shutdown. Do you have any solution regarding to this issue?

Śhāhēēd
  • 1,812
  • 6
  • 23
  • 44

1 Answers1

0

Try adding:

 <property name="shutdownEmbeddedDerby" value="false" dbms="derby"/>

To the changeset, this seems to prevent the shutdown when using Spring context.

See: