You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using var instead of val in our Mongo Entities, we are hitting this exception with RunEntity:
org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when encoding using the AutomaticPojoCodec.
Encoding a RunEntity: 'RunEntity(id=6626261252abc431948125e9, workspaceId=6626261252abc431948125e8, command=test command, status=test status, startTime=2024-04-22T10:55:46.629210944, endTime=2024-04-22T10:55:46.629000124, branch=test branch, runGroup=test run group, inner=true, distributedExecutionId=test distributed execution id, ciExecutionId=test ci execution id, ciExecutionEnv=test ci execution env, machineInfo=MachineInfo(machineId=, platform=, version=, cpuCores=0), meta={key=value}, vcsContext=VcsContext(branch=test branch, ref=test ref, title=test title, headSha=test head sha, baseSha=test base sha, commitLink=test commit link, author=test author, authorUrl=test author url, authorAvatarUrl=test author avatar url, repositoryUrl=test repository url, platformName=test platform name), linkId=test link id, projectGraph=ProjectGraph(nodes={node=Node(type=test type, name=test name, data={key=value})}, dependencies={dependency=[Dependency(source=test source, target=test target, type=test type)]}), hashedContributors=[test hashed contributors], sha=test sha)' failed with the following exception:
Failed to encode 'RunEntity'. Encoding 'projectGraph' errored with: Can't find a codec for CodecCacheKey{clazz=class org.nxcloudce.server.persistence.entity.RunEntity$ProjectGraph, types=null}.
A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.
at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
at org.nxcloudce.server.persistence.repository.RunPanacheRepositoryTest$should find entities with 'endTime' older than input$1.invokeSuspend(RunPanacheRepositoryTest.kt:43)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$1.invokeSuspend(TestBuilders.kt:316)
Suppressed: java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
at org.bson.codecs.pojo.TypeData.getNestedTypeData(TypeData.java:84)
at org.bson.codecs.pojo.TypeData.newInstance(TypeData.java:68)
at org.bson.codecs.pojo.TypeData.newInstance(TypeData.java:55)
at org.bson.codecs.pojo.PojoBuilderHelper.configureClassModelBuilder(PojoBuilderHelper.java:74)
at org.bson.codecs.pojo.ClassModelBuilder.<init>(ClassModelBuilder.java:59)
at org.bson.codecs.pojo.ClassModel.builder(ClassModel.java:69)
at org.bson.codecs.pojo.PojoCodecProvider.createClassModel(PojoCodecProvider.java:222)
at org.bson.codecs.pojo.PojoCodecProvider.createCodec(PojoCodecProvider.java:82)
at org.bson.codecs.pojo.PojoCodecProvider.get(PojoCodecProvider.java:72)
at org.bson.codecs.configuration.CodecProvider.get(CodecProvider.java:70)
at org.bson.internal.ProvidersCodecRegistry.getFromCodecProvider(ProvidersCodecRegistry.java:95)
at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:70)
at org.bson.internal.ProvidersCodecRegistry.getFromCodecProvider(ProvidersCodecRegistry.java:95)
at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:70)
at org.bson.internal.ProvidersCodecRegistry.getFromCodecProvider(ProvidersCodecRegistry.java:95)
at org.bson.codecs.configuration.OverridableUuidRepresentationCodecProvider.get(OverridableUuidRepresentationCodecProvider.java:47)
at org.bson.internal.ProvidersCodecRegistry.getFromCodecProvider(ProvidersCodecRegistry.java:95)
at org.bson.internal.ProvidersCodecRegistry.lambda$get$0(ProvidersCodecRegistry.java:82)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:80)
at org.bson.internal.ChildCodecRegistry.get(ChildCodecRegistry.java:68)
at org.bson.codecs.pojo.FallbackPropertyCodecProvider.get(FallbackPropertyCodecProvider.java:38)
at org.bson.codecs.pojo.PropertyCodecRegistryImpl.get(PropertyCodecRegistryImpl.java:52)
at org.bson.codecs.pojo.LazyPropertyModelCodec.getCodecFromPropertyRegistry(LazyPropertyModelCodec.java:96)
at org.bson.codecs.pojo.LazyPropertyModelCodec.createCodec(LazyPropertyModelCodec.java:83)
at org.bson.codecs.pojo.LazyPropertyModelCodec.getPropertyModelCodec(LazyPropertyModelCodec.java:72)
at org.bson.codecs.pojo.LazyPropertyModelCodec.encode(LazyPropertyModelCodec.java:57)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at org.bson.codecs.pojo.PojoCodecImpl.encodeValue(PojoCodecImpl.java:167)
at org.bson.codecs.pojo.PojoCodecImpl.encodeProperty(PojoCodecImpl.java:146)
at org.bson.codecs.pojo.PojoCodecImpl.encode(PojoCodecImpl.java:88)
at org.bson.codecs.pojo.AutomaticPojoCodec.encode(AutomaticPojoCodec.java:50)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:195)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:182)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:77)
at com.mongodb.internal.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:59)
at com.mongodb.internal.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:162)
at com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:136)
at com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:59)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceiveAsync(InternalStreamConnection.java:492)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceiveAsync(UsageTrackingInternalConnection.java:157)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceiveAsync(DefaultConnectionPool.java:802)
at com.mongodb.internal.connection.CommandProtocolImpl.executeAsync(CommandProtocolImpl.java:83)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.executeAsync(DefaultServer.java:232)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocolAsync(DefaultServerConnection.java:122)
at com.mongodb.internal.connection.DefaultServerConnection.commandAsync(DefaultServerConnection.java:102)
at com.mongodb.internal.connection.DefaultServer$AsyncOperationCountTrackingConnection.commandAsync(DefaultServer.java:370)
at com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommandAsync(MixedBulkWriteOperation.java:401)
at com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$executeBulkWriteBatchAsync$8(MixedBulkWriteOperation.java:303)
at com.mongodb.internal.async.function.AsyncCallbackLoop.run(AsyncCallbackLoop.java:56)
at com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatchAsync(MixedBulkWriteOperation.java:337)
at com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$executeAsync$4(MixedBulkWriteOperation.java:246)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSourceAndConnection$0(AsyncOperationHelper.java:117)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSuppliedResource$2(AsyncOperationHelper.java:133)
at com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$2(AsyncCallbackSupplier.java:101)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSuppliedResource$3(AsyncOperationHelper.java:134)
at com.mongodb.internal.connection.DefaultServer.lambda$getConnectionAsync$0(DefaultServer.java:130)
at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
at com.mongodb.internal.connection.DefaultConnectionPool.lambda$getAsync$0(DefaultConnectionPool.java:222)
at com.mongodb.internal.connection.DefaultConnectionPool.lambda$getAsync$1(DefaultConnectionPool.java:245)
at com.mongodb.internal.connection.DefaultConnectionPool$Task.doComplete(DefaultConnectionPool.java:1445)
at com.mongodb.internal.connection.DefaultConnectionPool$Task.execute(DefaultConnectionPool.java:1431)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.workerRun(DefaultConnectionPool.java:1375)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.runAndLogUncaught(DefaultConnectionPool.java:1402)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.lambda$initUnlessClosed$1(DefaultConnectionPool.java:1343)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when encoding using the AutomaticPojoCodec.
Encoding a RunEntity: 'RunEntity(id=6626261252abc431948125e9, workspaceId=6626261252abc431948125e8, command=test command, status=test status, startTime=2024-04-22T10:55:46.629210944, endTime=2024-04-22T10:55:46.629000124, branch=test branch, runGroup=test run group, inner=true, distributedExecutionId=test distributed execution id, ciExecutionId=test ci execution id, ciExecutionEnv=test ci execution env, machineInfo=MachineInfo(machineId=, platform=, version=, cpuCores=0), meta={key=value}, vcsContext=VcsContext(branch=test branch, ref=test ref, title=test title, headSha=test head sha, baseSha=test base sha, commitLink=test commit link, author=test author, authorUrl=test author url, authorAvatarUrl=test author avatar url, repositoryUrl=test repository url, platformName=test platform name), linkId=test link id, projectGraph=ProjectGraph(nodes={node=Node(type=test type, name=test name, data={key=value})}, dependencies={dependency=[Dependency(source=test source, target=test target, type=test type)]}), hashedContributors=[test hashed contributors], sha=test sha)' failed with the following exception:
Failed to encode 'RunEntity'. Encoding 'projectGraph' errored with: Can't find a codec for CodecCacheKey{clazz=class org.nxcloudce.server.persistence.entity.RunEntity$ProjectGraph, types=null}.
A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.
at org.bson.codecs.pojo.AutomaticPojoCodec.encode(AutomaticPojoCodec.java:53)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:195)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:182)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:77)
at com.mongodb.internal.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:59)
at com.mongodb.internal.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:162)
at com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:136)
at com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:59)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceiveAsync(InternalStreamConnection.java:492)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceiveAsync(UsageTrackingInternalConnection.java:157)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceiveAsync(DefaultConnectionPool.java:802)
at com.mongodb.internal.connection.CommandProtocolImpl.executeAsync(CommandProtocolImpl.java:83)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.executeAsync(DefaultServer.java:232)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocolAsync(DefaultServerConnection.java:122)
at com.mongodb.internal.connection.DefaultServerConnection.commandAsync(DefaultServerConnection.java:102)
at com.mongodb.internal.connection.DefaultServer$AsyncOperationCountTrackingConnection.commandAsync(DefaultServer.java:370)
at com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommandAsync(MixedBulkWriteOperation.java:401)
at com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$executeBulkWriteBatchAsync$8(MixedBulkWriteOperation.java:303)
at com.mongodb.internal.async.function.AsyncCallbackLoop.run(AsyncCallbackLoop.java:56)
at com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatchAsync(MixedBulkWriteOperation.java:337)
at com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$executeAsync$4(MixedBulkWriteOperation.java:246)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSourceAndConnection$0(AsyncOperationHelper.java:117)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSuppliedResource$2(AsyncOperationHelper.java:133)
at com.mongodb.internal.async.function.AsyncCallbackSupplier.lambda$whenComplete$2(AsyncCallbackSupplier.java:101)
at com.mongodb.internal.operation.AsyncOperationHelper.lambda$withAsyncSuppliedResource$3(AsyncOperationHelper.java:134)
at com.mongodb.internal.connection.DefaultServer.lambda$getConnectionAsync$0(DefaultServer.java:130)
at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:47)
at com.mongodb.internal.connection.DefaultConnectionPool.lambda$getAsync$0(DefaultConnectionPool.java:222)
at com.mongodb.internal.connection.DefaultConnectionPool.lambda$getAsync$1(DefaultConnectionPool.java:245)
at com.mongodb.internal.connection.DefaultConnectionPool$Task.doComplete(DefaultConnectionPool.java:1445)
at com.mongodb.internal.connection.DefaultConnectionPool$Task.execute(DefaultConnectionPool.java:1431)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.workerRun(DefaultConnectionPool.java:1375)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.runAndLogUncaught(DefaultConnectionPool.java:1402)
at com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager.lambda$initUnlessClosed$1(DefaultConnectionPool.java:1343)
at java.base@21.0.2/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base@21.0.2/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.2/java.lang.Thread.run(Thread.java:1583)
Caused by: org.bson.codecs.configuration.CodecConfigurationException: Failed to encode 'RunEntity'. Encoding 'projectGraph' errored with: Can't find a codec for CodecCacheKey{clazz=class org.nxcloudce.server.persistence.entity.RunEntity$ProjectGraph, types=null}.
at org.bson.codecs.pojo.PojoCodecImpl.encodeValue(PojoCodecImpl.java:171)
at org.bson.codecs.pojo.PojoCodecImpl.encodeProperty(PojoCodecImpl.java:146)
at org.bson.codecs.pojo.PojoCodecImpl.encode(PojoCodecImpl.java:88)
at org.bson.codecs.pojo.AutomaticPojoCodec.encode(AutomaticPojoCodec.java:50)
... 42 more
Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for CodecCacheKey{clazz=class org.nxcloudce.server.persistence.entity.RunEntity$ProjectGraph, types=null}.
at org.bson.internal.ProvidersCodecRegistry.lambda$get$0(ProvidersCodecRegistry.java:87)
at java.base@21.0.2/java.util.Optional.orElseGet(Optional.java:364)
at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:80)
at org.bson.internal.ChildCodecRegistry.get(ChildCodecRegistry.java:68)
at org.bson.codecs.pojo.FallbackPropertyCodecProvider.get(FallbackPropertyCodecProvider.java:38)
at org.bson.codecs.pojo.PropertyCodecRegistryImpl.get(PropertyCodecRegistryImpl.java:52)
at org.bson.codecs.pojo.LazyPropertyModelCodec.getCodecFromPropertyRegistry(LazyPropertyModelCodec.java:96)
at org.bson.codecs.pojo.LazyPropertyModelCodec.createCodec(LazyPropertyModelCodec.java:83)
at org.bson.codecs.pojo.LazyPropertyModelCodec.getPropertyModelCodec(LazyPropertyModelCodec.java:72)
at org.bson.codecs.pojo.LazyPropertyModelCodec.encode(LazyPropertyModelCodec.java:57)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at org.bson.codecs.pojo.PojoCodecImpl.encodeValue(PojoCodecImpl.java:167)
... 45 more
Because we have a 3rd level of nested objects (Run > ProjectGraph > Node/Dependency), it may be what's trigger the issue.
We should consider the following options:
Move ProjectGraph to a dedicated entity
Write a bson Codec w/ CodecProvider
The text was updated successfully, but these errors were encountered:
Description
When using
var
instead ofval
in our Mongo Entities, we are hitting this exception withRunEntity
:Because we have a 3rd level of nested objects (Run > ProjectGraph > Node/Dependency), it may be what's trigger the issue.
We should consider the following options:
ProjectGraph
to a dedicated entityCodec
w/CodecProvider
The text was updated successfully, but these errors were encountered: