Liquibase fails if computer is not connected to internet

liquibase

Solution

I stumbled across this myself recently.

You need to change this:

<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-3.0.xsd">

and remove the URL to the XSD:

<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 dbchangelog-3.0.xsd">

Note the space between `http://www.liquibase.org/xml/ns/dbchangelog` and `dbchangelog-3.0.xsd`. The first element is the URI for the namespace, the second element points to the actual XSD file. If that doesn't include a URL, the XML parser will try to use a local file.

Then put the actual XSD into the same directory where the changelog XML is located.

You need to download that from a computer with internet access of course, e.g. using:

wget http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd

or by simply opening the URL with the browser and then saving the file.

Note that you also need to specify a `.xsd` file for the schema location, not a `.xml` (as it is shown in the question).

Problem

When I am trying to start Liquibase (Karaf is used), I get the following error 'Failed to read schema document http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xml, bacause 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not ' If computer is connected to internet, this error is not reproduced.

Original source