如果计算机未连接到Internet,则Liquibase失败 [英] Liquibase fails if computer is not connected to internet
问题描述
当我尝试启动Liquibase(使用Karaf)时,出现以下错误
When I am trying to start Liquibase (Karaf is used), I get the following error
'无法读取架构文档 http://www.liquibase .org/xml/ns/dbchangelog/dbchangelog-3.0.xml ,因为1)找不到文档; 2)无法读取文件; 3)文档的根元素不是'
'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 '
如果计算机连接到Internet,则不会重现此错误.
If computer is connected to internet, this error is not reproduced.
推荐答案
我最近偶然发现了这个问题.
I stumbled across this myself recently.
您需要更改此内容:
<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">
并删除XSD的URL:
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">
请注意http://www.liquibase.org/xml/ns/dbchangelog
和dbchangelog-3.0.xsd
之间的空格.第一个元素是名称空间的URI,第二个元素指向实际的XSD文件.如果其中不包含URL,则XML解析器将尝试使用本地文件.
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.
然后将实际的XSD放入更改日志XML所在的目录中.
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
或通过使用浏览器简单地打开URL,然后保存文件.
or by simply opening the URL with the browser and then saving the file.
请注意,您还需要为架构位置指定一个 .xsd
文件,而不是.xml
(如问题所示).
Note that you also need to specify a .xsd
file for the schema location, not a .xml
(as it is shown in the question).
这篇关于如果计算机未连接到Internet,则Liquibase失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!