liquibase-2.0-rc2 and hibernate

Using 2.0-RC2 I am unable to get liquibase to talk to hibernate.
I’ve plugged hibernate3.jar (3.3.1-GA) into lib and tried:

    liquibase --url=jdbc:oracle:thin:@SOMECONNECTION --username=user --password=PASS --driver oracle.jdbc.OracleDriver --changeLogFile=ch.xml diffChangeLog --referenceUrl=hibernate:hibernate/hibernate.cfg.xml

where hibernate.cfg.xml is the one from the CONTRIB directory. This yields:

    Liquibase Update Failed: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:./hibernate/hibernate.cfg.xml) liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:./hibernate/hibernate .cfg.xml)         at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:77)         at liquibase.integration.commandline.Main.doMigration(Main.java:599)         at liquibase.integration.commandline.Main.main(Main.java:105) Caused by: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:./hibernate/hibernate.cfg.xml)         at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:58)         ... 2 more

what am i missing here?

thanks
pete

I moved the hibernate integration into a separate module with 2.0.  You’ll have to also get the latest hibernate integration plugin from http://liquibase.jira.com/wiki/display/CONTRIB/Hibernate+Integration and add it to your classpath.

Nathan

Thanks Nathan. Now the trouble is

    C:\Sabre\Dev\liquibase-2.0-rc2-bin>liquibase --logLevel DEBUG --url=jdbc:oracle:thin:@connection --username=USER --password=PASS --driver=oracle.jdbc.OracleDriver --changeLogFile=ch.xml diffChangeLog --referenceUrl=hibernate:hibernate/Hibernate.cfg.xml Liquibase Update Failed: org.dom4j.DocumentException Jul 14, 2010 3:03:18 PM liquibase.logging.jvm.JavaUtilLogger info INFO: org.dom4j.DocumentException java.lang.NoClassDefFoundError: org/dom4j/DocumentException         at liquibase.ext.hibernate.database.HibernateDatabase.createConfiguration(HibernateDatabase.java:360)         at liquibase.ext.hibernate.snapshot.HibernateDatabaseSnapshotGenerator.createSnapshot(HibernateDatabaseSnapshotGenerator.java:70)         at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69)         at liquibase.diff.Diff.compare(Diff.java:65)         at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:97)         at liquibase.integration.commandline.Main.doMigration(Main.java:609)         at liquibase.integration.commandline.Main.main(Main.java:105) Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException         at java.net.URLClassLoader$1.run(Unknown Source)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         ... 7 more

Both xmls are taken from liquibase repository.

I’m not sure if I’m facing the same problem. I have all parts in my classpath, but liquibase keeps failing to find the hibernate config.

    phurrelmann@ws1:trunk/logic$ java -jar tools/liquibase.jar  --classpath=lib/hibernate3.jar:tools/hibernate-annotations.jar:tools/hibernate-commons-annotations.jar:lib/hibernate3.jar:tools/liquibase-hibernate-2.0.jar:tools/postgresql-8.4-701.jdbc3.jar:lib/dom4j-1.6.1.jar:lib/slf4j-log4j12-1.5.10.jar:lib/slf4j-api-1.5.10.jar:lib/log4j-1.2.15.jar:lib/commons-logging-1.1.1.jar --logLevel=DEBUG --url=jdbc:postgresql://localhost:5432/test --username=test --password=test --driver=org.postgresql.Driver --changeLogFile=changelog.xml diffChangeLog --referenceUrl=hibernate:src/hibernate.cfg.xml log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. Liquibase Update Failed: src/hibernate.cfg.xml not found Jul 14, 2010 4:59:03 PM liquibase.logging.jvm.JavaUtilLogger info INFO: src/hibernate.cfg.xml not found liquibase.exception.DatabaseException: org.hibernate.HibernateException: src/hibernate.cfg.xml not found at liquibase.ext.hibernate.snapshot.HibernateDatabaseSnapshotGenerator.createSnapshot(HibernateDatabaseSnapshotGenerator.java:216) at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69) at liquibase.diff.Diff.compare(Diff.java:65) at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:97) at liquibase.integration.commandline.Main.doMigration(Main.java:609) at liquibase.integration.commandline.Main.main(Main.java:105) Caused by: org.hibernate.HibernateException: src/hibernate.cfg.xml not found at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1453) at org.hibernate.cfg.Configuration.configure(Configuration.java:1475) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:972) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69) at liquibase.ext.hibernate.snapshot.HibernateDatabaseSnapshotGenerator.createSnapshot(HibernateDatabaseSnapshotGenerator.java:71) ... 5 more

The configuration is there and readable:

    phurrelmann@ws1:trunk/logic$ ls -la src/hibernate.cfg.xml -rw-r--r-- 1 phurrelmann phurrelmann 10343 2010-07-12 17:57 src/hibernate.cfg.xml

The same error happens when using the ant-task. Is there anything I can do to further debug this?
I also tried the latest build from the build-server, but it seems to be way out of date (11. june).

ptsk, it looks like you need to add dom4j to your classpath.  Hibernate requires it.

Nathan

phurrelmann: try adding “src” to your classpath and referencing your file as just --referenceUrl=hibernate:hibernate.cfg.xml

Nathan

Originally posted by: Nathan
phurrelmann: try adding "src" to your classpath and referencing your file as just --referenceUrl=hibernate:hibernate.cfg.xml

Nathan

Thanks a lot! This made it working :wink:

I think adding this dependency should solve your problem

                   
                        org.liquibase.ext
                        liquibase-hibernate
                        2.0.0                       
                   

BTW if you are using maven the following link may help in the next issue you face

http://liquibase.org/forum/index.php?topic=864.0