【问题标题】:Liquibase Update FailedLiquibase 更新失败
【发布时间】:2012-08-31 03:58:06
【问题描述】:

我在liquibase 上使用以下快速入门

我的xml代码:

<?xml version="1.0" encoding="UTF-8"?> 
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

    <changeSet id="1" author="bob">
        <createTable tableName="department">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="active" type="boolean" defaultValueBoolean="true"/>
        </createTable>
    </changeSet>

</databaseChangeLog>

当我使用“更新”命令通过命令行运行 Liquibase 时,Liquibase 会告诉我这一点

INFO 8/31/12 9:17 AM:liquibase: Successfully released change log lock
Liquibase Update Failed: Content is not allowed in prolog.
SEVERE 8/31/12 9:17 AM:liquibase: Content is not allowed in prolog.
liquibase.exception.ChangeLogParseException: Error parsing line 1 column 1 of dat
abase.xml: Content is not allowed in prolog.
        at liquibase.parser.core.xml.XMLChangeLogSAXParser.parse(XMLChangeLogSAXP
arser.java:106)
        at liquibase.Liquibase.update(Liquibase.java:107)

我的更新命令是

liquibase --driver=com.mysql.jdbc.Driver  --classpath=mysql-connector-java-5.1.6.jar   --changeLogFile=database.xml --url="jdbc:mysql://localhost:3306/sample" --username=root --password=password  update

我该怎么做?

【问题讨论】:

    标签: liquibase


    【解决方案1】:

    这可能是因为您的 XML 文件开头有几个隐藏字符(如 BOM、google XML BOM 以获取更多信息)。

    This link 显示如何删除 BOM。

    如果您使用的是 Windows,XVI32(免费的十六进制编辑器)会为您工作。

    【讨论】:

      【解决方案2】:

      参考Liquibase JIRA issue

      此问题与架构定义有关...尝试使用给定链接的附件示例中的架构定义

      【讨论】:

        猜你喜欢
        • 2013-01-19
        • 2015-10-12
        • 2016-12-29
        • 2021-07-10
        • 2016-12-21
        • 2017-09-29
        • 2018-07-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多