Liquibase找不到解析器



我在运行更新时得到一个Liquibase异常。

Caused by: liquibase.exception.UnknownChangelogFormatException: 
Cannot find parser that supports <?xml version="1.0" encoding="UTF-8" standalone="no"?>

我认为Liquibase默认支持xml解析,所以我不确定这里的情况。当我初始化类时,我错过了一个配置吗?

  private lazy val liquibase: Liquibase = {
    val fsFO: ResourceAccessor = new FileSystemResourceAccessor
    val clFO: ResourceAccessor = new ClassLoaderResourceAccessor
    val contextClassLoader = Thread.currentThread().getContextClassLoader
    val threadClFO: ResourceAccessor = new ClassLoaderResourceAccessor(contextClassLoader)
    val database = DatabaseFactory.getInstance.findCorrectDatabaseImplementation(new JdbcConnection(connection))
    new Liquibase(changeLog, new CompositeResourceAccessor(clFO, fsFO, threadClFO), database)
  }
  def update(): Unit = Try(liquibase.update(context)) match {
    case Success(_) => log.info("LIQUIBASE FINISHED: Update change log")
    case Failure(ex) => throw new Exception("LIQUIBASE FAILED: Update change log", ex)
  }

变量变更日志是使用' java.o.File

读取的字符串
  val fileReader = new FileReader(file)
  val characters = new Array[Char](file.length().toInt)
  fileReader.read(characters)
  new String(characters)

Master.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
    <changeSet author="author" id="1444318866725-1">
        <createTable tableName="author">
            <column name="id" type="INT">
                <constraints nullable="false"/>
            </column>
            <column defaultValue="NULL::character varying" name="first_name" type="VARCHAR(255)"/>
            <column defaultValue="NULL::character varying" name="last_name" type="VARCHAR(255)"/>
        </createTable>
    </changeSet>
    <changeSet author="author" id="1444318866725-2">
        <addPrimaryKey columnNames="id" constraintName="author_pkey" tableName="author"/>
    </changeSet>
    <changeSet author="author" id="add-column-gender">
        <dropColumn tableName="author">
            <column name="first_name"/>
        </dropColumn>
        <addColumn tableName="author">
            <column name="gender" type="varchar(255)"/>
        </addColumn>
    </changeSet>
</databaseChangeLog>

问题似乎是changeLog变量不是包含变更日志文件路径的String

相关内容

  • 没有找到相关文章

最新更新