如果计算机未连接到互联网,Liquibase 将失败

2024-03-31

当我尝试启动 Liquibase(使用 Karaf)时,出现以下错误

'无法读取架构文档http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xml http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xml,因为1)找不到该文档; 2)文档无法读取; 3) 文档的根元素不是 '

如果计算机连接到互联网,则不会重现此错误。


我自己最近偶然发现了这一点。

你需要改变这个:

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

<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 and dbchangelog-3.0.xsd。第一个元素是命名空间的 URI,第二个元素指向实际的 XSD 文件。如果不包含 URL,XML 解析器将尝试使用本地文件。

然后将实际的 XSD 放入变更日志 XML 所在的同一目录中。

您需要从计算机下载它with当然可以访问互联网,例如使用:

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

或者只需使用浏览器打开 URL,然后保存文件。

请注意,您还需要指定.xsd架构位置的文件,而不是.xml(如问题所示)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如果计算机未连接到互联网,Liquibase 将失败 的相关文章

随机推荐