0

I don't understand what exactly is wrong with Liquibase because the path is specified correctly

Caused by: java.io.FileNotFoundException: class path resource [db/master.xml] cannot be resolved to URL because it does not exist
    at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
    at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:599)
    at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
    at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:71)
    ... 24 common frames omitted

application.yml file:

spring:
  liquibase:
    change-log: "classpath:/db/master.xml"

EDIT 1 Project structure

enter image description here

EDIT 2 Folder with compiled classes

enter image description here

pringi
  • 3,987
  • 5
  • 35
  • 45
Drics
  • 41
  • 1
  • 10
  • please have look of this post: https://stackoverflow.com/questions/60683101/liquibase-problem-class-path-resource-db-changelog-db-changelog-master-yaml/ – Raushan Kumar Dec 29 '21 at 14:44
  • @RaushanKumar I tried everything described there and it didn't help – Drics Dec 29 '21 at 17:57
  • @Drics And, does the resource actually exist? I mean. if you look for the resource in your application jar or `target` directory, is it there? Your configuration looks fine to me. – jccampanero Dec 29 '21 at 21:56
  • @jccampanero Yes, the resource exists and the path to it is correct, but liquibase for some reason does not see it. I added a screenshot with the project structure – Drics Dec 30 '21 at 08:09
  • Thank you very much for the feeback @Drics. Please, could you provide an screenshot of the folder in which your classes are compiled as well? – jccampanero Dec 30 '21 at 10:28
  • @jccampanero If I understood you correctly, then please look at the second edit of the post – Drics Dec 30 '21 at 11:17
  • just try with an absolute path :) ,from image it looks okay to me – Raushan Kumar Dec 30 '21 at 11:43
  • Thank you @Drics. Yes, that is what I was asking for. According tho the screenshot, note how the resources directory contains `main/db/master.xml`. It may be ok according to your configuration, but it may be not. Please, could you try `change-log: "classpath:main/db/master.xml"`? – jccampanero Dec 30 '21 at 11:50
  • @jccampanero thanks for the idea provided, but it didn't help – Drics Dec 30 '21 at 14:11
  • You are welcome @Drics. I think the problem is related to your IDE configuration, something strange is happening... Just to be sure, copy your `db` folder in the directory that contains your actual class files, and try again. I hope it helps. – jccampanero Dec 30 '21 at 16:59
  • @jccampanero Thank you very much! It's really helped me! – Drics Dec 30 '21 at 22:01
  • You are welcome @Drics. I hope that the suggestion helps. – jccampanero Dec 30 '21 at 22:02

1 Answers1

0

try to remove leading slash in your path

spring:
  liquibase:
    change-log: "classpath:db/master.xml"