Spring Liquibase尝试解析URL的文件路径 [英] Spring Liquibase tries to resolve file path to URL
问题描述
我是这样配置 liquibase 的:
I configured liquibase like this:
@Bean
public SpringLiquibase liquibase() {
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setDataSource(getConfiguredDataSouce());
liquibase.setChangeLog("classpath*:config/liquibase/master.xml");
liquibase.setContexts("development,test,production");
LOG.debug("Configuring Liquibase");
return liquibase;
}
我的master.xml文件:
my master.xml file:
<includeAll path="classpath*:/config/liquibase/changelog/" relativeToChangelogFile="false"/>
当我在Tomcat(7.0.50和8.0.20)上运行我的应用程序时,它会显示以下异常:
When I run my application on Tomcat (7.0.50 and 8.0.20) it prints this exception:
Caused by: java.io.FileNotFoundException: class path resource [D:/proiecte/ALE MELE/Rezervari/target/Rezervari/WEB-INF/classes/config/liquibase/changelog/20150329182213.xml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:178)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:109)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:181)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:93)
... 73 more
该文件存在于该路径上,但是它尝试(因为我不知道是什么原因)将其解析为URL.有任何想法吗?:)
That file exists on that path, but it tries (for I don't know what reason) to resolve it to an URL. Any ideas? :)
P.S.:Liquibase版本为3.2.2.
P.S.: Liquibase version is 3.2.2.
谢谢你,德金.
推荐答案
对我来说,这个问题特别斜线(本地,MacOS):
For me the issue was in extra slash (local, MacOS):
"classpath:config/liquibase/changelog/"-效果很好.
"classpath:config/liquibase/changelog/" - works well.
类路径:/config/liquibase/changelog/"-不起作用.
"classpath:/config/liquibase/changelog/" - does not work.
这篇关于Spring Liquibase尝试解析URL的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!