user899876
user899876

Reputation:

Liquibase Update Failed

I am using the following the quickstart on liquibase

My xml Code:

<?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>

When I run Liquibase via command line using "update" command .Liquibase tells me this

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)

My update command is

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

How do I do this?

Upvotes: 4

Views: 7332

Answers (2)

Abhishek Chatterjee
Abhishek Chatterjee

Reputation: 2049

Refer to Liquibase JIRA issue

This problem is related to schema definitions...try with schema definition from attachment example of the given link

Upvotes: 0

su-
su-

Reputation: 3176

It's probably because there are several hidden characters (such as BOM, google XML BOM for more information) at the beginning of your XML file.

This link shows how to remove BOM.

If you are using Windows, XVI32 (a free hex editor) would work for you.

Upvotes: 2

Related Questions