title: Table already exists error when replacing yaml by XML
body: <p>I am trying to run some migrations on my MySQL database.While using db.changelog-master as a yaml file everything worked fine. I intend to use a xml file as db.changelog so I added <code> spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml</code> to my properties and created this two xml files</p>
  <h2>db.changelog-master.xml</h2>
  <pre><code>&lt;databaseChangeLog
          xmlns=&quot;http://www.liquibase.org/xml/ns/dbchangelog&quot;
          xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
          xsi:schemaLocation=&quot;http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd&quot;&gt;
  
      &lt;include file=&quot;/db/changelog/db.changelog-1.0.xml&quot;/&gt;
      &lt;include file=&quot;/db/changelog/db.changelog-2.0.xml&quot;/&gt;
  
  &lt;/databaseChangeLog&gt;
  </code></pre>
  <h2>db.changelog-1.0.xml</h2>
  <pre><code>&lt;databaseChangeLog
          xmlns=&quot;http://www.liquibase.org/xml/ns/dbchangelog&quot;
          xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
          xsi:schemaLocation=&quot;http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd&quot;&gt;
   
      &lt;changeSet author=&quot;gunter&quot; id=&quot;changelog-1.0&quot;&gt;
          &lt;createTable tableName=&quot;employee&quot;&gt;
              &lt;column name=&quot;id&quot; type=&quot;serial&quot; autoIncrement=&quot;true&quot;&gt;
                  &lt;constraints nullable=&quot;false&quot; primaryKey=&quot;true&quot;/&gt;
              &lt;/column&gt;
              &lt;column name=&quot;first_name&quot; type=&quot;varchar(255)&quot;&gt;
                  &lt;constraints nullable=&quot;false&quot;/&gt;
              &lt;/column&gt;
              &lt;column name=&quot;last_name&quot; type=&quot;varchar(255)&quot;&gt;
                  &lt;constraints nullable=&quot;false&quot;/&gt;
              &lt;/column&gt;
          &lt;/createTable&gt;
          &lt;rollback&gt;
              &lt;dropTable tableName=&quot;employee&quot;/&gt;
          &lt;/rollback&gt;
      &lt;/changeSet&gt;
   
  &lt;/databaseChangeLog&gt;
  </code></pre>
  <p>When I try to run my project I get the following error</p>
  <h2>Error</h2>
  <pre><code>Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2021-02-25 21:56:26.319 ERROR 13920 --- [           main] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeController': Unsatisfied dependency expressed through field 'employeeDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeDao': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/db.changelog-1.0.xml::changelog-1.0::gunter:
       Reason: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[spring-context-5.3.4.jar:5.3.4]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582) ~[spring-context-5.3.4.jar:5.3.4]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.3.jar:2.4.3]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.3.jar:2.4.3]
      at com.tutorial.demo.TutorialApplication.main(TutorialApplication.java:10) ~[classes/:na]
  Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'employeeDao': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/db.changelog-1.0.xml::changelog-1.0::gunter:
       Reason: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.4.jar:5.3.4]
      ... 21 common frames omitted
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/db.changelog-1.0.xml::changelog-1.0::gunter:
       Reason: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.4.jar:5.3.4]
      ... 35 common frames omitted
  Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/db.changelog-1.0.xml::changelog-1.0::gunter:
       Reason: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:124) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Liquibase.lambda$null$0(Liquibase.java:273) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.lambda$child$0(Scope.java:160) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:169) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:159) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:138) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:222) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Liquibase.lambda$update$1(Liquibase.java:272) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.lambda$child$0(Scope.java:160) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:169) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:159) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:138) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Liquibase.runInScope(Liquibase.java:2322) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Liquibase.update(Liquibase.java:216) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Liquibase.update(Liquibase.java:202) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:322) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:275) ~[liquibase-core-4.3.1.jar:na]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[spring-beans-5.3.4.jar:5.3.4]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-5.3.4.jar:5.3.4]
      ... 47 common frames omitted
  Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/db.changelog-1.0.xml::changelog-1.0::gunter:
       Reason: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at liquibase.changelog.ChangeSet.execute(ChangeSet.java:672) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:49) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:111) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.lambda$child$0(Scope.java:160) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:169) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:159) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:138) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:110) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.lambda$child$0(Scope.java:160) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:169) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:159) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:138) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:222) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:94) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.lambda$child$0(Scope.java:160) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:169) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:159) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:138) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:222) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.Scope.child(Scope.java:226) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:66) ~[liquibase-core-4.3.1.jar:na]
      ... 65 common frames omitted
  Caused by: liquibase.exception.DatabaseException: Table 'employee' already exists [Failed SQL: (1050) CREATE TABLE test.employee (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, CONSTRAINT PK_EMPLOYEE PRIMARY KEY (id))]
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:82) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:150) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1275) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1257) ~[liquibase-core-4.3.1.jar:na]
      at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637) ~[liquibase-core-4.3.1.jar:na]
      ... 85 common frames omitted
  Caused by: java.sql.SQLSyntaxErrorException: Table 'employee' already exists
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.23.jar:8.0.23]
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.23.jar:8.0.23]
      at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:762) ~[mysql-connector-java-8.0.23.jar:8.0.23]
      at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:646) ~[mysql-connector-java-8.0.23.jar:8.0.23]
      at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-3.4.5.jar:na]
      at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-3.4.5.jar:na]
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:389) ~[liquibase-core-4.3.1.jar:na]
      ... 90 common frames omitted
  
  
  Process finished with exit code 1
  </code></pre>
  <p>I guess is some kind of error in keeping track of the migrations already made</p>