Skip to content

org.bson.codecs.configuration.CodecConfigurationException: The uuidRepresentation has not been specified, so the UUID cannot be encoded. #3546

Closed
@airtaste

Description

@airtaste

I'm trying to upgrade the version of spring boot from 2.3.0 to 2.4.0. After updates I've tried to run my unit tests and got codec exception 😞

Caused by: org.bson.codecs.configuration.CodecConfigurationException: The uuidRepresentation has not been specified, so the UUID cannot be encoded.

at org.bson.codecs.UuidCodec.encode(UuidCodec.java:72)
at org.bson.codecs.UuidCodec.encode(UuidCodec.java:37)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:203)
at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:217)
at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:159)
at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:46)
at org.bson.Document.toJson(Document.java:440)
at org.bson.Document.toJson(Document.java:413)
at org.bson.Document.toJson(Document.java:400)
at org.springframework.data.mongodb.core.convert.MongoConverters$DocumentToStringConverter.convert(MongoConverters.java:241)
at org.springframework.data.mongodb.core.convert.MongoConverters$DocumentToStringConverter.convert(MongoConverters.java:234)
at org.springframework.core.convert.support.GenericConversionService$ConverterAdapter.convert(GenericConversionService.java:386)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)

An example of a simplified project: https://github.com/airtaste/example/tree/master

Also, I've tried to use Spring Boot property spring.data.mongodb.uuid-representation and set it to 'standard', but the error still occurred. Furthermore, I tried to customize MongoClientSettings to include UuidRepresentation.STANDARD codec registry. Ineffectually.

It's a very odd issue.

Thanks in advance!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions