【问题标题】:Liquibase, local XSD referenceLiquibase,本地 XSD 参考
【发布时间】:2016-02-11 06:10:28
【问题描述】:

我正在使用我的 liquibase xml 配置文件(spring 集成)和以下符号

<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.1.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  
      classpath:xsd/dbchangelog-3.1.xsd">

但我有跟随错误。你能帮帮我吗?

Caused by: java.net.MalformedURLException: unknown protocol: classpath
        at java.net.URL.<init>(URL.java:592)
        at java.net.URL.<init>(URL.java:482)
        at java.net.URL.<init>(URL.java:431)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:610)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:582)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:685)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2175)

【问题讨论】:

标签: java xml spring xsd liquibase


【解决方案1】:

我通过在项目中添加相关的 XSD 文件 dbchangelog-3.5.xsd 本地 并更新 Liquibase 配置文件(xsi:schemaLocation 部分)解决了这个问题,例如这个:

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

所以现在 XSD 文件位置配置为 dbchangelog-3.5.xsd。只需确保 XSD 文件与 Liquibase 配置文件位于同一目录

【讨论】:

  • 谢谢,不幸的是,我必须在类路径中搜索文件。您的解决方案不是您要求的解决方案
猜你喜欢
  • 2013-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-22
  • 1970-01-01
相关资源
最近更新 更多