Error when running diff with Spring Boot and Postgres

Hey,

I’m trying to use liquibase in an spring boot application. My pom.xml:

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.4</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.felixoi</groupId>
	<artifactId>dragonfly</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>dragonfly</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<java.version>16</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<version>2.4.4</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<version>2.4.4</version>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.2.19</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-maven-plugin</artifactId>
			<version>3.4.2</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>2.4.4</version>
			</plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>15</source>
                    <target>15</target>
                </configuration>
            </plugin>

			<plugin>
				<groupId>org.liquibase</groupId>
				<artifactId>liquibase-maven-plugin</artifactId>
				<version>4.3.2</version>
				<configuration>
					<propertyFileWillOverride>true</propertyFileWillOverride>
					<propertyFile>src/main/resources/liquibase.properties</propertyFile>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.liquibase.ext</groupId>
						<artifactId>liquibase-hibernate5</artifactId>
						<version>4.3.2</version>
					</dependency>
					<dependency>
						<groupId>org.springframework.boot</groupId>
						<artifactId>spring-boot-starter-data-jpa</artifactId>
						<version>2.4.4</version>
					</dependency>
					<dependency>
						<groupId>org.postgresql</groupId>
						<artifactId>postgresql</artifactId>
						<version>42.2.19</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>

</project>

My liquibase.properties:

liquibase.properties
changeLogFile=src/main/resources/liquibase-changeLog.xml
url=jdbc:postgresql://localhost:5432/testdb
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml
driver=org.postgresql.Driver
username=user
password=password
referenceUrl=hibernate:spring:com.felixoi.dragonfly.model?dialect=org.hibernate.dialect.PostgreSQL95Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver

However when I’m running the diff goal there is an error inside I can’t fix:

HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
HHH000342: Could not obtain connection to query metadata

Full Stacktrace: gist:28d2b8df67e37bb1b8c72975ab226ecc · GitHub

Postgres Version: 13.2

The diff job still succeeds but how i get fix this error inside the goal?
Maybe someone of you has an idea.

Thanks for your help,
felixoi

Hi @felixoi ,

I looked into error [WARNING] HHH000342: Could not obtain connection to query metadata

java.lang.UnsupportedOperationException: The application must supply JDBC connections, and I see this is on the Hibernate side, and I am not an expert but this issue looked the most promising.

Are you sure your query is right, the version of the database metadata the version you expect?