# Unable to add Pro License Key in Java Application

**URL:** <https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441>\
**Category:** Liquibase Development\
**Created:** [July 20, 2023, 1:35pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441 "2023-07-20T13:35:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhuri](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@madhuri](https://forum.liquibase.org/u/madhuri)\
**Post date:** [July 20, 2023, 1:35pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/1 "2023-07-20T13:35:51Z")

</div>

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](https://forum.liquibase.org/t/liquibase-pro-license-key-in-java-application/6478)). Using both variables we are getting the below warning in the startup.

```auto
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](https://docs.liquibase.com/workflows/liquibase-pro/how-to-apply-your-liquibase-pro-license-key.html#:~:text=If%20you%20use%20Maven%2C%20include%20the%20Liquibase%20Pro%20license%20key%20in%20the%20%3Cproperties%3E%20section%20of%20your%20pom.xml%20file%3A)

We also have tried passing through parameters

```auto
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

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

```

Any Help is highly appreciated!

Thank you,  
Madhuri

---

<div class="post-metadata">

**Author:** ![kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/kevin/32/244_2.png) [@kevin](https://forum.liquibase.org/u/kevin)\
**Post date:** [August 17, 2023, 8:42pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/2 "2023-08-17T20:42:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![darrensteele](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@darrensteele](https://forum.liquibase.org/u/darrensteele)\
**Post date:** [March 28, 2024, 12:18pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/3 "2024-03-28T12:18:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![darrensteele](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@darrensteele](https://forum.liquibase.org/u/darrensteele)\
**Post date:** [March 29, 2024, 3:28pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/4 "2024-03-29T15:28:33Z")

</div>

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());

```

---

<div class="post-metadata">

**Author:** ![wwillard](https://avatars.discourse-cdn.com/v4/letter/w/8e8cbc/32.png) [@wwillard](https://forum.liquibase.org/u/wwillard)\
**Post date:** [March 30, 2024, 5:57pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/5 "2024-03-30T17:57:40Z")

</div>

Darren,

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

```auto
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

---

<div class="post-metadata">

**Author:** ![darrensteele](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@darrensteele](https://forum.liquibase.org/u/darrensteele)\
**Post date:** [March 31, 2024, 6:29pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/6 "2024-03-31T18:29:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wwillard](https://avatars.discourse-cdn.com/v4/letter/w/8e8cbc/32.png) [@wwillard](https://forum.liquibase.org/u/wwillard)\
**Post date:** [April 2, 2024, 1:52pm UTC](https://forum.liquibase.org/t/unable-to-add-pro-license-key-in-java-application/8441/7 "2024-04-02T13:52:43Z")

</div>

Darren,

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

Thanks,  
Wesley
