class java.time.LocalDateTime cannot be cast to class java.lang.String configuring MySQL 8 with Crowd

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 5.0.0
    • Affects Version/s: 4.2.2
    • Component/s: Database
    • None
    • 11
    • Severity 3 - Minor
    • 62

      MySQL made the following change with the introduction of MySQL 8.0.23 ( Changes in MySQL Connector/J 8.0.23):

      Also, with the implementation of the new mechanism, a getObject(columnIndex) call on a DATETIME column returns a LocalDateTime object now instead of a String. To receive a String like before, use getObject(columnIndex, String.class) instead.

      When trying to configure a Crowd instance with MySQL 8.0.23+ JDBC driver the following error results and configuration fails:

      2021-05-25 10:10:07,139 http-nio-6430-exec-21 ERROR [console.action.setup.Database] Database configuration failed. java.time.LocalDateTime cannot be cast to java.lang.String
      java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String
      	at liquibase.changelog.StandardChangeLogHistoryService.getRanChangeSets(StandardChangeLogHistoryService.java:328)
      	at liquibase.changelog.AbstractChangeLogHistoryService.upgradeChecksums(AbstractChangeLogHistoryService.java:66)
      	at liquibase.changelog.StandardChangeLogHistoryService.upgradeChecksums(StandardChangeLogHistoryService.java:297)
      	at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1174)
      	at liquibase.Liquibase.update(Liquibase.java:192)
      	at liquibase.Liquibase.update(Liquibase.java:178)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.runLiquibaseUpdate(LiquibaseSchemaHelper.java:154)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.lambda$updateSchemaIfNeeded$1(LiquibaseSchemaHelper.java:76)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.withServiceRegistry(LiquibaseSchemaHelper.java:178)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.withServiceRegistry(LiquibaseSchemaHelper.java:164)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.updateSchemaIfNeeded(LiquibaseSchemaHelper.java:75)
      	at com.atlassian.crowd.util.persistence.hibernate.LiquibaseSchemaHelper.createSchema(LiquibaseSchemaHelper.java:84)
      	at com.atlassian.crowd.console.setup.DefaultHibernateConfigurator.refreshSpringContextAndCreateDatabase(DefaultHibernateConfigurator.java:102)
      	at com.atlassian.crowd.console.setup.DefaultHibernateConfigurator.configureDatabase(DefaultHibernateConfigurator.java:53)
      	at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.bootstrapDatabase(DefaultAtlassianBootstrapManager.java:254)
      	at com.atlassian.crowd.manager.bootstrap.CrowdBootstrapManagerImpl.bootstrapDatabase(CrowdBootstrapManagerImpl.java:74)
      	at com.atlassian.crowd.console.action.setup.Database.configureJdbc(Database.java:262)
      	at com.atlassian.crowd.console.action.setup.Database.update(Database.java:118)
      ...
      

      Crowd should check for this change in MySQL and use getObject(columnIndex, String.class) as it appears this will be the process going forward for MySQL.

      Workaround

      As of now, the only workaround is to downgrade to MySQL 8.0.22 JDBC driver.

            Assignee:
            Patryk
            Reporter:
            Cole Aronson
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: