Can't find a codec for class

I have been using Mongo DB for a few months using the Java API.

Occasionally (about 50% of the time :frowning: ) when I start my service (either on Ubuntu server or my mac development machine) I get the error - “org.bson.codecs.configuration.CodecConfigurationException: Can’t find a codec for class” followed by my class name for all queries and inserts.

My class is a relatively simple POJO if I restart the service, it usually works. I am looking for ideas as to why this might happen?

Any ideas?

That’s odd, and nothing we’ve heard about. If you can create a reproducer that we can run locally, we can look into it.

Good idea. I will try and create a cut down version that shows the problem.

And dit you find a solution? Running into the same problem here.
Using Spring boot and some custom classes, but when querying the database we get the same kind of exception:
org.bson.codecs.configuration.CodecConfigurationException: Can’t find a codec for class nl.devolksbank.bsp.shared.frontoffice.hypotheken.model.database.hypotheekdossier.aanvrager.AanvragerEntiteit.

Sorry but I can’t remember what the problem was. I managed to create a small process (with the same class) where I could replicate the issue. I then cut out parts of the class until it started working.

It might have been that I had an arraylist instead of a list or I had a function starting with ‘is’ that could return null

Sorry I can’t be more helpful. I should have updated this when I fixed it :frowning:

Going through my git logs - I had a string variable called ‘incident’ and a Boolean variable called isIncident() .

I just changed the function name …

I hope that helps :slight_smile: