Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting java.lang.ClassCastException exceptions in log file

I have a newly installed Confluence server installation, running with a MySQL 8.0.23 database on Ubuntu 20.04.1.  I started with Confluence 7.10.2, and then upgraded it to 7.11.1.  The error message below happened both before the upgrade and after.

The atlassian-confluence.log gets full of repeated entries similar to the following:


2021-03-01 13:12:32,383 ERROR [Caesium-1-3] [migration.agent.queue.QueueBroker] error An error occurred when getting the next batch for consumer type: USERS_MIGRATION. Message: java.l>com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.Lo> at com.atlassian.util.concurrent.LazyReference.getInterruptibly(
at com.atlassian.util.concurrent.LazyReference.get(


Instead of "USERS_MIGRATION" - it repeats a similar error with "CONFLUENCE_EXPORT" - "DATA_UPLOAD" - "ATTACHMENT_UPLOAD" - "CONFLUENCE_IMPORT" - in sequence, cycling through those errors.  They seem to get recorded every 10 seconds or so in the log.  

I've searched here in the forums, but can't find this mentioned similarly.

Is this a real actual error, or just a warning?  Is there a resolution to clean this up so that the log file is more useful?

If additional information would be useful to help diagnose, please let me know.

Thanks, - Eric

5 answers

The exaception thrown to indicate that your code has attempted to cast an object to a subclass of which it is not an instance. This means that ClassCastException occurs when you try to cast an instance of an Object to a type that it is not. Type Casting only works when the casted object follows an is a relationship to the type you are trying to cast to.

It is good practice to guard any explicit casts with an instanceof check first:

if (myApple instanceof Fruit) {
Fruit myFruit = (Fruit)myApple;

When will be ClassCastException is thrown:

  • When you try to cast an object of Parent class to its Child class type, this exception will be thrown.
  • When you try to cast an object of one class into another class type that has not extended the other class or they don't have any relationship between them.
0 votes
Charlie Misonne Community Leader Jun 17, 2021

Hi Eric,

I stumbled upon this post whil dealing with the same issue and want to share my solution.

This is a change in the 8.0.23 mysql driver: So it's not a bug but a change.

I'd suggest to use driver 8.0.22 which works for me.

Thanks Charlie, works for me too

Like Charlie Misonne likes this
Charlie Misonne Community Leader Oct 08, 2021


The right driver can be downloaded from You should select Connector/J. J stands for Java wich is the technology Confluence runs on.
Then click archives and choose 8.0.22. For Operating System I always use platform indepentent and wonload the zip or tar.gz file. The jar file is in the zip file.
Direct URL:

@Eric Zago I noticed you asked this in one of the other questions but I tried to keep the solution clear on this post.

Thanks I think I've tried this before, but Confluence would not run. 

My Ubuntu 20.04.2 server is currently running with mysql 8.0.26

When one swaps the mysql-connector-java-8.0.22.jar file into /opt/atlassian/confluence/confluence/WEB-INF/lib/ - do you also have to down grade the version of mysql that is installed?  Or should it work to have mysql 8.0.26 running with the 8.02.22.jar file?

Thanks - I have some system downtime scheduled soon and am happy to try again, just want to have a good plan in mind.


Thanks Stan

It resolved problem

alright, I was able to resolve this issue by downgrading mysql database driver from mysql-connector-java-8.0.23 to mysql-connector-java-5.1.42

I am circling around back to this issue - I'm don't seem to fully understand the solution.  When installing, I downloaded the mysql-connector-java_8.0.23-1ubuntu20.10_all.deb file from, installed it with dpkg, and then copied the mysql-connector-java-8.0.23.jar file from  /usr/share/java/ to /opt/atlassian/confluence/confluence/WEB-INF/lib/ - and it works (well, except for the errors in the log mentioned above.

Today I downloaded mysql-connector-java-5.1.42.tar.gz - since there does not seem to be a .deb file available from for 5.1.42.  I copied the mysql-connector-java-5.1.42-bin.jar into the /usr/share/java/ and /opt/atlassian/confluence/confluence/WEB-INF/lib/ directories, rebooted for good measure, and now when the atlassian-confluence.log file shows:

2021-05-11 09:11:09,474 ERROR [Catalina-utility-2] [confluence.impl.setup.DefaultBootstrapDatabaseAccessor] getBootstrapData Unable to open database connection during bootstrap.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Which suggests to me that what I've downloaded isn't the right thing, since it is not able to make a database connection.  I was able to put back the mysql-connector-java-8.0.23.jar file into the above two directories, and I'm able to restart Confluence and it runs (but once again, with those same errors as above.

Can someone help point out what I'm missing?

Thanks, -Eric

experiencing the same issue right now, @Eric Zago did you figure out?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

259 views 5 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you