使用Spring应用程序将Liquibase嵌入罐中

时间:2015-07-16 12:34:51

标签: java spring liquibase

我试图在uberjar中嵌入带有liquibase的纯Spring(而不是Spring Boot)应用程序时遇到了一个特定的错误。一旦SpringLiquibase bean被初始化,它就开始寻找我不理解的东西:

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)

我知道MANIFEST.MF中的Liquibase-Package条目,并使用shade插件填充它(虽然我不知道它有什么用途)并使用shade插件来填充它,但它没有&# 39;没有任何效果。什么是liquibase寻找,我该如何克服这些错误?

1 个答案:

答案 0 :(得分:1)

根据此issue,如果您创建src / main / webapp文件夹,此问题将得到解决:

  

偶然地,根本原因是不存在src / main / webapp文件夹。解决方法是,您可以在@WebAppConfiguration中创建一个或设置一个值,该值指向classpath:实际存在的文件夹。