org.bson.codecs.configuration.CodecConfigurationException

Can't find a codec for class java.time.ZonedDateTime.

Samebug tips2

Current Spark-Mongodb does not support 3.x mongo drivers. Use long instead of Date until it is upgraded.

Current Spark-Mongodb does not support 3.x mongo drivers. Use long instead of Date until it is upgraded.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web44

  • via Unknown by Mark Paluch,
  • Stack trace

    • org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime. at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:37) at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:210) at com.mongodb.DBObjectCodec.encodeMap(DBObjectCodec.java:220) at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:196) at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:128) at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:61) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91) at org.bson.codecs.BsonDocumentCodec.writeValue(BsonDocumentCodec.java:133) at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:112) at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:40) at com.mongodb.connection.RequestMessage.addDocument(RequestMessage.java:253) at com.mongodb.connection.RequestMessage.addDocument(RequestMessage.java:205) at com.mongodb.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:75) at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160) at com.mongodb.connection.CommandProtocol.sendMessage(CommandProtocol.java:192) at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:111) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286) at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:173) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:215) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:206) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:112) at com.mongodb.operation.CountOperation$1.call(CountOperation.java:210) at com.mongodb.operation.CountOperation$1.call(CountOperation.java:206) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:230) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:203) at com.mongodb.operation.CountOperation.execute(CountOperation.java:206) at com.mongodb.operation.CountOperation.execute(CountOperation.java:53) at com.mongodb.Mongo.execute(Mongo.java:772) at com.mongodb.Mongo$2.execute(Mongo.java:759) at com.mongodb.DBCollection.getCount(DBCollection.java:962) at com.mongodb.DBCollection.getCount(DBCollection.java:937) at com.mongodb.DBCollection.getCount(DBCollection.java:931) at com.mongodb.DBCollection.getCount(DBCollection.java:914) at com.mongodb.DBCollection.getCount(DBCollection.java:885) at com.mongodb.DBCollection.count(DBCollection.java:824) at com.querydsl.mongodb.AbstractMongodbQuery.fetchCount(AbstractMongodbQuery.java:391) at com.querydsl.mongodb.AbstractMongodbQuery.fetchResults(AbstractMongodbQuery.java:376) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:104) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy69.findAll(Unknown Source) at com.favendo.squirrel.persistence.CrudNutRepositoryTests.readTimeFrame(CrudNutRepositoryTests.java:83)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    DunmerDunmer
    6 times, last one
    Alireza MohamadiAlireza Mohamadi
    2 times, last one
    rprp
    Once,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    31 more bugmates