1

I'm writing a pf4j plugin that uses liquibase. The plugin host has dependencies on slf4j

implementation "org.slf4j:slf4j-log4j12:$slf4jVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"

And the plugin has these dependencies as compile only, as well liquibase core

compileOnly "org.slf4j:slf4j-log4j12:$slf4jVersion"
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
implementation "org.liquibase:liquibase-core:$liquibaseVersion"

However, when the plugin is run, liquibase cannot find its default logger. and throws the following exception.

Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find default log service
    at liquibase.Scope.getCurrentScope(Scope.java:71)
    at liquibase.database.core.PostgresDatabase.<clinit>(PostgresDatabase.java:36)

I have a feeling that this is because both pf4j and liquibase use their own service loaders, and I have a feeling they may be clashing. Does anyone have any suggestions? I'm really well and truly stuck.

Thanks, Peter

Peter McKinney
  • 463
  • 3
  • 13
  • Were you able to get unstuck? If so, can you share your solution? I found an article that may have a solution for you if you haven't resolved it already. http://www.bennybottema.com/2013/12/29/fixing-liquibase-logging-in-spring/ – tabbyfoo Jun 01 '22 at 21:16

0 Answers0