Uploaded image for project: 'Migration Platform'
  1. Migration Platform
  2. MIG-603

MySQL 8 driver causes class java.time.LocalDateTime cannot be cast to class java.lang.String error

    XMLWordPrintable

Details

    • 93
    • Severity 2 - Major

    Description

      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.

      Confluence seems to work correctly, however, the following message flood the application logs:

      [migration.agent.queue.QueueBroker] error An error occurred when getting the next batch for consumer type: CONFLUENCE_IMPORT. Message: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap')
      
      [migration.agent.queue.QueueBroker] error An error occurred when getting the next batch for consumer type: CONFLUENCE_IMPORT. Message: java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String
      com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.lang.String
      

      Confluence 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 driver.

      Attachments

        Issue Links

          Activity

            People

              06540738b612 Aman Jadon
              rgadami Rodrigo Girardi Adami
              Votes:
              46 Vote for this issue
              Watchers:
              74 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: