Liquibase generateChangeLog Failed: org/yaml/snakeyaml/representer/Representer

I got the same error too. It looks like liquibase cannot find snakeyaml jar on the classpath for some reason.
Another problem is that I need to explicitly set classpath for the driver. Placing the jar in the lib directory doesn’t help at all contrary to what readme.txt says.

I’m new to LiquiBase, so I’m not sure where I’m going wrong.


I’m running  … 12 more




I had the same error and finally decided to try a different package of the same version and it started to work.


I downloaded:

liquibase-3.0.4-bin.zip


rather than:


liquibase.properties


#liquibase.properties

driver=com.mysql.jdbc.Driver

classpath=/root/scripts/liquibase/lib/mysql-connector-java-5.1.17.jar:/root/scripts/liquibase/lib/snakeyaml-1.12.jar

changeLogFile=changelog/blah-diff-changelog.xml

url=jdbc:mysql://localhost:4000/blah

username=temp

referenceUrl=jdbc:mysql://localhost/blah

referenceUsername=temp

logLevel=info

logFile=log/liquibase.log


The mysql connector in liquibase/lib is just a symlink.

  1. java -cp lib/snakeyaml-1.12.jar;liquibase.jar liquibase.integration.commandline.Main --defaultsFile props/mig.properties --changeLogFile generated.xml generateChangeLog 


The commandline above works for me to fix this:

  1. Liquibase generateChangeLog Failed: org/yaml/snakeyaml/representer/Representer

If this is not going to be fixed then it should be noted in the doc that you have to add the yaml.jar to the classpath by yourself.

Thanks for the suggestion. 


I tried it, but I get the same output.


I should add that I’m running this on my Mac - does that matter?

I’ve switched back to version 2.0.5 and it works there.

You have to add the snakeyaml to the classpath if you are calling liquibase directly from java rather than using the batch or shell script. Same with the jdbc drivers, they should get picked up automatically from the lib dir, but only if you use the bat/sh script. I’ll take a look a the tar.gz version to make sure that is being packaged correctly.


I also created https://liquibase.jira.com/browse/CORE-1448 for making a more helpful error message.


Nathan

Thanks Nathan, using the shell script solved this problem for me :slight_smile:


I just had to give the +x permissions to the “liquibase” file to make it executable. The other thing is that I did not notice its a shell script initially because it did not have the .sh file extension (duh!).

Thanks for pointing that out. I added the executable flag to the file for the next release.


Nathan