Unable to add Pro License Key in Java Application

Hi

We are using liquibase of version 4.21.1. We are unable to pass the liquibase trial license in the Java application. We are able to pass the license to the liquibase cli using the environment variable LIQUIBASE_LICENSE_KEY. We have tried to pass the same env variable as well as the LIQUIBASE_PRO_LICENSE_KEY variable as mentioned in this issue(Liquibase Pro License Key in Java Application). Using both variables we are getting the below warning in the startup.

WARNING: 

Liquibase detected the following invalid LIQUIBASE_* environment variables:

- LIQUIBASE_LICENSE_KEY
- LIQUIBASE_PRO_LICENSE_KEY

Find the list of valid environment variables at https://docs.liquibase.com/environment-variables

We also have tried the solution provided in this URL - How to Apply Your Liquibase Pro License Key

We also have tried passing through parameters

Scope.child(config, () -> {
            liquibase.Liquibase liquibase = new liquibase.Liquibase(changelogFile, new ClassLoaderResourceAccessor(), database);

            liquibase.setChangeLogParameter("liquibaseLicenseKey", "xxxxxxxx");
....

Tried with all these keys in the above parameters liquibaseLicenseKey, liquibaseProLicenseKey, licenseKey, proLicenseKey.

Nothing seems to be working. Please let us know if we have to use a different library or if we have missed anything.

Dependency

      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-core</artifactId>
      <version>4.21.1</version>
    </dependency>

Any Help is highly appreciated!

Thank you,
Madhuri

Were you able to get this working, or is this still an issue?

I’m running into a similar problem. Does anyone out there have a solution for getting the pro key into a java application?

To give some more info I’m building a java module using the Inductive Automation Ignition platform. It’s basically a standard Java application built using Maven. I’ve exported a changelog using CLI and I’m now trying to import the changelog into a databse via a JDBC but it is failing when I run into the first “pro” line that is bringing in a trigger or stored proc. This is why I feel I need to do something differently in the java to make use of my pro license key

I start liquibase with the code below and I’m currently using 4.26.0

                    Liquibase liquibase = new liquibase.Liquibase("changelog.sql", new ClassLoaderResourceAccessor(), database);
                    liquibase.update(new Contexts(), new LabelExpression());

Darren,

You can pass the license key like this, using Scope.

String licensekey = "xxxxxx";
Map<String, Object> scopedValues = new HashMap<>();
scopedValues.put("liquibase.licenseKey", licenseKey);
Scope.child(scopedValues, () -> {
    Liquibase liquibase = new liquibase.Liquibase("changelog.sql", new ClassLoaderResourceAccessor(), database);
    liquibase.update(new Contexts(), new LabelExpression());
});

Thanks,
Wesley

Wesley,

Thanks so much - that looks really promising but I haven’t got it to work just yet. The problem I’m having is that I had to revert back to 3.x.x to get past an annoying …

Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find default log service

issue whereby versions 4.x.x of liquibase couldn’t find the default log service.

I’m sure this is to do with the way I’m using org.slf4j but I couldn’t get to the bottom of it. I’m quite happy to start a new thread for this issue if that’s best. If you could point me to some documentation about how to set up a default logging service then that would be great.

Darren,

Sorry for the delay. I think a new thread would be good for the log service issue.

Thanks,
Wesley