liquibase迁移2.x到3.0的问题

时间:2014-03-12 09:38:38

标签: java liquibase

我正在使用SQL Server 2012和liquibase版本2.0.1来支持Java应用程序(java版本1.7)中的数据库更新。

我想将liquibase版本迁移到3.x,我正在从liquibase site

获取帮助

它说 Liquibase 3.0.0是任何Liquibase 2.0.x版本的直接替代品。

当我用3.0.0版本的jar替换现有版本以及依赖项时,我得到以下错误 -

Liquibase updateSQL Failed: liquibase/database/structure/type/DataType

日志中的详细错误:

INFO 3/12/14 3:02 PM:liquibase: Successfully acquired change log lock
INFO 3/12/14 3:02 PM:liquibase: Successfully released change log lock
INFO 3/12/14 3:02 PM:liquibase: Successfully released change log lock
SEVERE 3/12/14 3:02 PM:liquibase: liquibase/database/structure/type/DataType
java.lang.NoClassDefFoundError: liquibase/database/structure/type/DataType
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:264)
            at liquibase.change.custom.CustomChangeWrapper.setClass(CustomChangeWrapper.java:84)
            at liquibase.parser.core.xml.XMLChangeLogSAXHandler.setProperty(XMLChangeLogSAXHandler.java:585)
            at liquibase.parser.core.xml.XMLChangeLogSAXHandler.setAllProperties(XMLChangeLogSAXHandler.java:517)
            at liquibase.parser.core.xml.XMLChangeLogSAXHandler.startElement(XMLChangeLogSAXHandler.java:405)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:744)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2717)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
            at liquibase.parser.core.xml.XMLChangeLogSAXParser.parse(XMLChangeLogSAXParser.java:101)
            at liquibase.parser.core.xml.XMLChangeLogSAXHandler.handleIncludedChangeLog(XMLChangeLogSAXHandler.java:561)
            at liquibase.parser.core.xml.XMLChangeLogSAXHandler.startElement(XMLChangeLogSAXHandler.java:164)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
            at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:775)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2717)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
            at liquibase.parser.core.xml.XMLChangeLogSAXParser.parse(XMLChangeLogSAXParser.java:101)
            at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:216)
            at liquibase.Liquibase.update(Liquibase.java:194)
            at liquibase.Liquibase.update(Liquibase.java:253)
            at liquibase.Liquibase.update(Liquibase.java:236)
            at liquibase.integration.commandline.Main.doMigration(Main.java:894)
            at liquibase.integration.commandline.Main.main(Main.java:133)
Caused by: java.lang.ClassNotFoundException: liquibase.database.structure.type.DataType
            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:423)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
            ... 41 more

1 个答案:

答案 0 :(得分:1)

从更改日志结构的角度来看,3.0是一个替代品,但是有一些打破了基础Java API的变化,这就是为什么版本从2.x跳到3.x.

http://www.liquibase.org/v3_upgrade.html列出了一些更改,但您的特定问题似乎是您有一个使用liquibase.database.structure.type.DataType对象的类,该对象已移至liquibase.structure.core.DataType in 3.0。

如果您针对liquibase 3.0重新编译自定义更改类,编译器应该会发现此更改以及任何其他API更改。