I’m using liquibase to initialize a number of tables (Sybase) via spring and am getting the following exception upon startup. We are basically only using liquibase to initialize a few tables for us. I’m not even sure where to start looking… recommendations? I’m happy to provide more information, but I’m not even sure which is relevant…
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.myproject.SystemDatasourceMigrator' defined in URL [file:/D:/projects/myproject/etc/datasources.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [liquibase.integration.spring.SpringLiquibase]: Constructor threw exception; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:901)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:105)
at com.myserver.ServerMain.start(ServerMain.java:60)
at com.myserver.ServerMain.main(ServerMain.java:40)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [liquibase.integration.spring.SpringLiquibase]: Constructor threw exception; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:948)
... 14 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at liquibase.servicelocator.DefaultPackageScanClassResolver.addIfMatching(DefaultPackageScanClassResolver.java:345)
at liquibase.servicelocator.DefaultPackageScanClassResolver.loadImplementationsInJar(DefaultPackageScanClassResolver.java:313)
at liquibase.servicelocator.DefaultPackageScanClassResolver.find(DefaultPackageScanClassResolver.java:195)
at liquibase.servicelocator.DefaultPackageScanClassResolver.find(DefaultPackageScanClassResolver.java:113)
at liquibase.servicelocator.DefaultPackageScanClassResolver.findImplementations(DefaultPackageScanClassResolver.java:83)
at liquibase.servicelocator.ServiceLocator.findClassesImpl(ServiceLocator.java:163)
at liquibase.servicelocator.ServiceLocator.findClasses(ServiceLocator.java:138)
at liquibase.servicelocator.ServiceLocator.findClass(ServiceLocator.java:102)
at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:151)
at liquibase.logging.LogFactory.getLogger(LogFactory.java:17)
at liquibase.integration.spring.SpringLiquibase.(SpringLiquibase.java:125)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 16 more
It does just use the java logger by default. Because of how we are doing class lookup now in 2.0 to support extensions, there have been some bugs around classloading. Are you running in an app server, if so, which one?
Originally posted by: Nathan
Would you be able to set the a system JVM property of liquibase.defaultlogger.level to debug and post the ouput?
…
Nathan
Um… there are over 1000 lines there (which is well over what the forum will let me post). Here’s, what I think might be relevant to you. I cut out 800 lines or so from the middle. Let me know if I missed something.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/me/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/projects/myproject/runtime/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
…
No properties path set - looking for transactions.properties in classpath…
Using init file: /D:/projects/myproject/runtime/etc/transactions.properties
DEBUG 19/08/10 1:17 PM:liquibase: ServiceLocator.findClasses for liquibase.logging.Logger
DEBUG 19/08/10 1:17 PM:liquibase: ServiceLocator finding classes matching interface liquibase.logging.Logger
DEBUG 19/08/10 1:17 PM:liquibase: Searching for implementations of liquibase.logging.Logger in packages: [liquibase.change, liquibase.database, liquibase.parser, liquibase.precondition, liquibase.serializer, liquibase.sqlgenerator, liquibase.executor, liquibase.snapshot, liquibase.logging, liquibase.ext]
DEBUG 19/08/10 1:17 PM:liquibase: Searching for: is assignable to Logger in package: liquibase/change using classloader: sun.misc.Launcher$AppClassLoader
DEBUG 19/08/10 1:17 PM:liquibase: Getting resource URL for package: liquibase/change with classloader: sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: URL from classloader: jar:file:/D:/projects/myproject/runtime/lib/liquibase-core-1.9.5.jar!/liquibase/change/
DEBUG 19/08/10 1:17 PM:liquibase: Decoded urlPath: file:/D:/projects/myproject/runtime/lib/liquibase-core-1.9.5.jar!/liquibase/change/ with protocol: jar
DEBUG 19/08/10 1:17 PM:liquibase: Scanning for classes in [/D:/projects/myproject/runtime/lib/liquibase-core-1.9.5.jar] matching criteria: is assignable to Logger
DEBUG 19/08/10 1:17 PM:liquibase: Loading from jar using file: D:\projects\myproject\runtime\lib\liquibase-core-1.9.5.jar
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.change.AbstractChange matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Loaded the class: class liquibase.change.AbstractChange in classloader: sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.change.RenameViewChange matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Loaded the class: class liquibase.change.RenameViewChange in classloader: sun.misc.Launcher$AppClassLoader@11b86e7
…
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.parser.visitor.ChangeSetVisitor matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Loaded the class: interface liquibase.parser.visitor.ChangeSetVisitor in classloader: sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.parser.visitor.DBDocVisitor$1 matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Loaded the class: class liquibase.parser.visitor.DBDocVisitor$1 in classloader: sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: URL from classloader: jar:file:/D:/projects/myproject/runtime/lib/liquibase-core-2.0-rc5.jar!/liquibase/parser/
DEBUG 19/08/10 1:17 PM:liquibase: Decoded urlPath: file:/D:/projects/myproject/runtime/lib/liquibase-core-2.0-rc5.jar!/liquibase/parser/ with protocol: jar
DEBUG 19/08/10 1:17 PM:liquibase: Scanning for classes in [/D:/projects/myproject/runtime/lib/liquibase-core-2.0-rc5.jar] matching criteria: is assignable to Logger
DEBUG 19/08/10 1:17 PM:liquibase: Loading from jar using file: D:\projects\myproject\runtime\lib\liquibase-core-2.0-rc5.jar
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.parser.core.xml.XMLChangeLogSAXHandler$1 matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Loaded the class: class liquibase.parser.core.xml.XMLChangeLogSAXHandler$1 in classloader: sun.misc.Launcher$AppClassLoader@11b86e7
DEBUG 19/08/10 1:17 PM:liquibase: Testing that class liquibase.parser.core.formattedsql.FormattedSqlChangeLogParser matches criteria [is assignable to Logger] using classloader:sun.misc.Launcher$AppClassLoader@11b86e7
Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.myproject.SystemDatasourceMigrator’ defined in URL [file:/D:/projects/myproject/runtime/etc/datasources.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [liquibase.integration.spring.SpringLiquibase]: Constructor threw exception; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:901)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:105)
at com.myserver.ServerMain.start(ServerMain.java:60)
at com.myserver.ServerMain.main(ServerMain.java:40)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [liquibase.integration.spring.SpringLiquibase]: Constructor threw exception; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:948)
… 14 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at liquibase.servicelocator.DefaultPackageScanClassResolver.addIfMatching(DefaultPackageScanClassResolver.java:345)
at liquibase.servicelocator.DefaultPackageScanClassResolver.loadImplementationsInJar(DefaultPackageScanClassResolver.java:313)
at liquibase.servicelocator.DefaultPackageScanClassResolver.find(DefaultPackageScanClassResolver.java:195)
at liquibase.servicelocator.DefaultPackageScanClassResolver.find(DefaultPackageScanClassResolver.java:113)
at liquibase.servicelocator.DefaultPackageScanClassResolver.findImplementations(DefaultPackageScanClassResolver.java:83)
at liquibase.servicelocator.ServiceLocator.findClassesImpl(ServiceLocator.java:163)
at liquibase.servicelocator.ServiceLocator.findClasses(ServiceLocator.java:138)
at liquibase.servicelocator.ServiceLocator.findClass(ServiceLocator.java:102)
at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:151)
at liquibase.logging.LogFactory.getLogger(LogFactory.java:17)
at liquibase.integration.spring.SpringLiquibase.(SpringLiquibase.java:125)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
… 16 more
</code]
That looks like the section I need, but it’s not showing what the problem is, unfortuantely. I added some new logging in trunk. I’m hoping to get an RC6 build out, can you post what the debug info from that?
I’m on vacation next week, and will probably not be able to get RC6 out before I leave. I’m hoping to have RC6 out early the week of the 30th with a 2.0 final in early sept.
I did some re-building and deploying and it looks like I had some jar issues… So appologies the above looks to be something I did. I’m getting past that part now.
However, when running on Sybase (MySQL seems to work).I’m now getting the following on startup.
Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE "DATABASECHANGELOG" (ID VARCHAR(150) NOT NULL, AUTHOR VARCHAR(150) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED DATETIME NOT NULL, ORDEREXECUTED INT NOT NULL UNIQUE, EXECTYPE VARC HAR(10) NOT NULL, MD5SUM VARCHAR(35) NULL, DESCRIPTION VARCHAR(255) NULL, COMMENTS VARCHAR(255) NULL, TAG VARCHAR(255) NULL, LIQUIBASE V ARCHAR(20) NULL, PRIMARY KEY(ID, AUTHOR, FILENAME))
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:97)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:70)
at liquibase.database.AbstractDatabase.checkDatabaseChangeLogTable(AbstractDatabase.java:429)
at liquibase.Liquibase.checkDatabaseChangeLogTable(Liquibase.java:527)
at liquibase.Liquibase.forceReleaseLocks(Liquibase.java:563)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:223)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFac tory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactor y.java:1409)
... 13 more
Caused by: java.sql.SQLException: There is already an object named 'DATABASECHANGELOG' in the database.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723)
at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1160)
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:88)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
… 21 more
talon,
I guess, you have run into an old disease of the liquibase using another table schema in the changeSet. The problem of the TSQL based dbms (sybase, mssql) they using schema.user.object notation to refer one in the another schemas. For example, if you are logged as ‘sa’ in the liquibase schema, snippet ‘create table DATABASECHANGELOG (…)’ build dbo.DATABASECHANGELOG table. If you login with other account (anotheruser) it could create anotheruser.DATABASECHANGELOG. Both table are exists together in one schema. To fix this liquibase must always to generate a dbo.DATABASECHANGELOG syntax but it does not.
May by you ran a JUnit tests against that database. Currently it (I’ve ran ones against mssql server) has a flaw not cleaning the liquibaseb.DATABASECHANGELOG table. You could check using an isql or other tool and remove all unnecessary artefacts.
I’ve removed all of the databases that were created. Actually, I’m getting this off of a fresh database (I dropped all of the tables). The DATABASECHANGELOG and DATABSECHANGELOGLOCK tables are created and then there is this error.