Thanks. I changed the jdbc driver for the referencedatabase only to liquibase.ext.hibernate.database.connection.HibernateDriver based on something I read in one of the forum posts here. So my target looks like this:
- <target name="diff-against-hibernate2">
<liquibase:diffDatabaseToChangeLog
databaseref="my-database"
classpathref="mypath.classpath"
diffTypes="tables,columns,views">
<referencedatabase
driver="liquibase.ext.hibernate.database.connection.HibernateDriver"
url="${liquibase.persistence.unit}"
user="${liquibase.database.username}"
password="${liquibase.database.password}"/>
<txt outputfile="hibernate-diff-test.xml"/>
</liquibase:diffDatabaseToChangeLog>
</target>
- [liquibase:diffDatabaseToChangeLog] WARNING 4/13/16 11:15 AM: liquibase: Can not use class liquibase.ext.hibernate.database.HibernateSpringDatabase as a Liquibase service because org.springframework.beans.factory.support.BeanDefinitionRegistry is not in the classpath
[liquibase:diffDatabaseToChangeLog] Reading hibernate configuration hibernate:ejb3:emrEJB?dialect=org.hibernate.dialect.OracleDialect
BUILD FAILED
C:\Production\jboss_emr_eap\g2\dbautomation.xml:52: java.lang.NoClassDefFoundError: javax/persistence/PersistenceException
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.lang.NoClassDefFoundError: javax/persistence/PersistenceException
at liquibase.ext.hibernate.database.HibernateEjb3Database.buildConfigurationFromFile(HibernateEjb3Database.java:76)
at liquibase.ext.hibernate.database.HibernateEjb3Database.buildConfiguration(HibernateEjb3Database.java:28)
at liquibase.ext.hibernate.database.HibernateDatabase.setConnection(HibernateDatabase.java:44)
at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:123)
at liquibase.integration.ant.type.DatabaseType.createDatabase(DatabaseType.java:82)
at liquibase.integration.ant.BaseLiquibaseTask.createDatabaseFromType(BaseLiquibaseTask.java:96)
at liquibase.integration.ant.AbstractDatabaseDiffTask.getDiffResult(AbstractDatabaseDiffTask.java:24)
at liquibase.integration.ant.DiffDatabaseToChangeLogTask.executeWithLiquibaseClassloader(DiffDatabaseToChangeLogTask.java:44)
at liquibase.integration.ant.BaseLiquibaseTask.execute(BaseLiquibaseTask.java:81)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
... 10 more
Caused by: java.lang.ClassNotFoundException: javax.persistence.PersistenceException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 24 more
- <target name="generate-database-dll">
<liquibase:generateChangeLog databaseref="my-database"
classpathref="mypath.classpath" >
<liquibase:xml outputfile="/path/to/output/changelog.xml" encoding="UTF-8"/>
</liquibase:generateChangeLog>
</target>