Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Liquibase in a jar with Spring Application

I'm getting quite a specific error while trying to embed pure Spring (not Spring Boot) application with liquibase in an uberjar. As soon as SpringLiquibase bean is initialized, it starts looking for something i don't understand:

WARNING 7/16/15 3:22 PM: liquibase: No Liquibase-Packages entry found in MANIFEST.MF. Using fallback of entire 'liquibase' package
WARNING 7/16/15 3:28 PM: liquibase: Error initializing SpringLiquibase
java.io.FileNotFoundException: ServletContext resource [/liquibase] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:156)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.init(SpringLiquibase.java:117)
at liquibase.resource.AbstractResourceAccessor.<init>(AbstractResourceAccessor.java:22)
at liquibase.resource.ClassLoaderResourceAccessor.<init>(ClassLoaderResourceAccessor.java:19)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.<init>(SpringLiquibase.java:74)
at liquibase.integration.spring.SpringLiquibase.createResourceOpener(SpringLiquibase.java:489)
at liquibase.integration.spring.SpringLiquibase.createLiquibase(SpringLiquibase.java:439)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:389)
WARNING 7/16/15 3:28 PM: liquibase: Error initializing SpringLiquibase
java.io.FileNotFoundException: ServletContext resource [/liquibase] cannot be resolved to URL because it does not exist
(stacktrace again)

I'm aware of Liquibase-Package entry in MANIFEST.MF and filling it using shade plugin (though i don't understand what use does it have) and putting it using shade plugin, but it doesn't give any effect. What is liquibase looking for and how can i overcome those errors?

like image 955
Etki Avatar asked Jul 16 '15 12:07

Etki


1 Answers

According to this issue, this issue would be fixed if you create a src/main/webapp folder:

Incidentally, the root cause is that no src/main/webapp folder exists. As a work around you could create one or set a value in @WebAppConfiguration that points to classpath: folder that actually exists.

like image 158
Ariel Kohan Avatar answered Sep 22 '22 08:09

Ariel Kohan