diff --git a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java index 4db6f88c81..c53b6c66d3 100644 --- a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java +++ b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java @@ -139,6 +139,8 @@ public class AgroalConnectionProvider implements ConnectionProvider, Configurabl @Override public void stop() { - agroalDataSource.close(); + if ( agroalDataSource != null ) { + agroalDataSource.close(); + } } }