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.
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).
This problem was fixed. It turns Liquibase-osgi.jar contains own packages and also it contains liquibase.jar. When LiquibaseEntityResolver.java tries to find *.xsd, it finds two files *.xsd with same name. And after that liquibase throws Exception. I deleted duplicate files and everything was working
BTW Root element of changelog file looks like
<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">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With