Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing line 1 column 1 of changelog.xml: Premature end of file #4

Closed
bflemi3 opened this issue Mar 6, 2020 · 1 comment
Closed

Comments

@bflemi3
Copy link

bflemi3 commented Mar 6, 2020

I'm getting an exception when trying to run the liquibase update command using a docker image built using liquibase/docker.

13:52:03.674 ERROR [liquibase.integration.commandline.Main]: Unexpected error running Liquibase: Premature end of file.
liquibase.exception.ChangeLogParseException: Error parsing line 1 column 1 of changelog.xml: Premature end of file.
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:120)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.commandline.Main.doMigration(Main.java:1649)
at liquibase.integration.commandline.Main.run(Main.java:303)
at liquibase.integration.commandline.Main.main(Main.java:163)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:112)
... 7 common frames omitted

Command

docker run --network host -v changelog.xml:/liquibase/changelog.xml 3pr-migrations --url=jdbc:mysql://localhost:3306/tprportal?serverTimezone=UTC --driver=com.mysql.cj.jdbc.Driver --classpath=/usr/share/java/mysql-jdbc.jar --changeLogFile=changelog.xml --username=portalapi --password=password --logLevel=debug  update

My Dockerfile just copies the mysql jdbc driver into /usr/share/java/ since the mysql driver isn't included in your image.

FROM liquibase/liquibase

ARG jdbc_driver_version
ENV jdbc_driver_version=${jdbc_driver_version:-8.0.19}
ENV jdbc_driver_download_url=https://repo1.maven.org/maven2/mysql/mysql-connector-java/${jdbc_driver_version}

USER root

RUN set -x -e pipefail;\
    echo "JDBC DRIVER VERSION: $jdbc_driver_version";\
    jarfile=mysql-connector-java-${jdbc_driver_version}.jar;\
    curl -SOLs ${jdbc_driver_download_url}/${jarfile};\
    mv ${jarfile} /usr/share/java/mysql-jdbc.jar;\
    chmod 755 /usr/share/java/mysql-jdbc.jar;

USER liquibase

changelog.xml

<?xml version="1.1" 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.7.xsd" >
    <changeSet author="brandonfleming" id="create_table_reports">
        <sqlFile encoding="utf8" path="./migrations/create_table_reports.sql" relativeToChangeLogFile="true" />
        <rollback>
            <sqlFile encoding="utf8" path="./migrations/create_table_reports.rollback.sql" relativeToChangeLogFile="true" />
        </rollback>
    </changeSet>
</databaseChangeLog>
@r2-lf
Copy link
Contributor

r2-lf commented Jul 20, 2020

We're including mysql drivers now with the image. Is this still an issue?

@r2-lf r2-lf closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants