Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase/Springboot startup exception

Starting yesterday (Sunday) morning my production app fails to start, with no code changes from my side. It's running Springboot 2.3.4, Liquibase-core 3.8.0 and is hosted on Amazon linux2. Funny thing is there are no exceptions locally, only when deployed.

Here is the relevant stack trace:

Caused by: liquibase.exception.UnexpectedLiquibaseException: java.nio.file.NoSuchFileException: /tmp/agent12302722365010540729.jar
 at liquibase.servicelocator.ServiceLocator.setResourceAccessor(ServiceLocator.java:129)
 at liquibase.servicelocator.ServiceLocator.<init>(ServiceLocator.java:69)
 at liquibase.servicelocator.CustomResolverServiceLocator.<init>(CustomResolverServiceLocator.java:16)
 at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener$LiquibasePresent.replaceServiceLocator(LiquibaseServiceLocatorApplicationListener.java:55)
 at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener.onApplicationEvent(LiquibaseServiceLocatorApplicationListener.java:44)
 at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener.onApplicationEvent(LiquibaseServiceLocatorApplicationListener.java:36)
...
Caused by: java.nio.file.NoSuchFileException: /tmp/agent801508645517312012.jar
  at liquibase.resource.ClassLoaderResourceAccessor.getResourcesAsStream(ClassLoaderResourceAccessor.java:53)
  at liquibase.servicelocator.ServiceLocator.setResourceAccessor(ServiceLocator.java:115)

I double checked all application related files and env variables and they are all the same. The file in question is in no way related to my app.

Do you have any idea what this file is and why is Liquibase trying to find it all of the sudden?

like image 514
mihristov Avatar asked Dec 20 '21 12:12

mihristov


People also ask

How does Liquibase work with spring boot?

If we're using Spring Boot, there is no need to define a bean for Liquibase, but we still need to make sure we add the liquibase-core dependency. Then all we need is to put our change log in db/changelog/db. changelog-master. yaml, and Liquibase migrations will run automatically on startup.

How do I turn off my Liquibase hub?

out or logging) by disabling the Liquibase Hub by mentioning liquibase. hub. mode=off in liquibase. properties .

What is Liquibase in Spring Boot?

The purpose of this tutorial is to guide you through the process of using Liquibase as part of your Spring Boot workflow. Spring Boot makes it easy to create standalone, production grade Spring-based applications. Spring Boot allows you to create Java applications that can be started by using java -jar or war deployments.

How to run springliquibase without running on startup?

It is the only solution that makes a SpringLiquibase bean available for autowiring without running on startup. Remember to put it in a @Configuration class. There is one more programmatic approach. If you want to run Liquibase manually, you could use the liquibase maven plugin. Just add something like this to your pom.xml:

Why do I have to remove the Liquibase starter?

That's why you have to remove the liquibase starter, or any direct liquibase dependency if you added any. If you only have the liquibase maven plugin, liquibase is not in the application classpath.

What is Spring Boot and how does it work?

Spring Boot allows you to create Java applications that can be started by using java -jar or war deployments. With Spring Boot, some of the heavy lifting of configuring beans to set up things like messaging, database connection, migration, and others are already done for you.


1 Answers

I had the same problem. On the startup of the amazon linux 2, there is a security patch that is installed.

The package causing the problem is log4j-cve-2021-44228-hotpatch.noarch (you can check that in /var/log/yum.log)

A temporary solution is to uninstall the patch and install another java version.

yum remove log4j-cve-2021-44228-hotpatch.noarch
yum install java-11-openjdk-11.0.12.0.7-0.amzn2.0.2.x86_64

Thanks to @mihristov for the solution.

like image 86
Reda Avatar answered Sep 22 '22 05:09

Reda