Not loading SnakeYAML?

Hi, when I run the command listed at the top of this output, I get the rest:


  1. liquibase --changeLogFile=db.cams.yaml --classpath=snakeyaml-1.12.jar  update

  2. INFO 11/06/13 12:18:liquibase: Successfully acquired change log lock
  3. INFO 11/06/13 12:18:liquibase: Successfully released change log lock
  4. Liquibase update Failed: org.yaml.snakeyaml.Yaml
  5. SEVERE 11/06/13 12:18:liquibase: org.yaml.snakeyaml.Yaml
  6. java.lang.NoClassDefFoundError: org/yaml/snakeyaml/Yaml
  7.         at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:47)
  8.         at liquibase.Liquibase.update(Liquibase.java:128)
  9.         at liquibase.integration.commandline.Main.doMigration(Main.java:851)
  10.         at liquibase.integration.commandline.Main.main(Main.java:138)
  11. Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.Yaml
  12.         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  13.         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  14.         at java.security.AccessController.doPrivileged(Native Method)
  15.         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  16.         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
  17.         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  18.         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
  19.         ... 4 more

snakeyaml-1.12.jar is in the current working directory. If I try with --classpath=boo:

  1. Liquibase update Failed: C:\w\juno\CAMS\CAMSLogicClient\resources\boo does not exist
  2. SEVERE 11/06/13 12:23:liquibase: C:\w\juno\CAMS\CAMSLogicClient\resources\boo does not exist
  3. liquibase.exception.CommandLineParsingException: C:\w\juno\CAMS\CAMSLogicClient\
  4. resources\boo does not exist
  5.         at liquibase.integration.commandline.Main.configureClassLoader(Main.java:641)
  6.         at liquibase.integration.commandline.Main.main(Main.java:137)

So Liquibase is clearly finding the JAR. I’ve looked inside the JAR and org/yaml/snakeyaml/Yaml.class exists.


Has anyone got this working please?

The problem is because the classpath liquibase parameter sets a sub-classloader whereas snakeyaml needs to be in the classloader that is running liqubase itself.


If you add snakeyaml to a new “lib” dir within the liquibase directory it will find it automatically without having to reference it. There is a bug that is resolved in the next release to include snakeyaml in that dir automatically.


Nathan

That’s got it, thanks Nathan.

Hi, 

I am facing the same issue. I tried creating lib dir but still not working.

I am using liquibase 3.5.3.