此处提供的示例项目: https ://github.com/codependent/micronaut-aws-lambda-proxy-graal
我在 Amazon AWS 上部署了一个 Micronaut 应用程序作为 Lambda 函数。它被编译成 GraalVM 原生镜像并使用AWS Lambda Custom Runtime 运行。
如果应用程序不使用 DynamoDB,它会顺利运行。当配置它并作为一个普通的 Java 应用程序启动时,它也可以正常工作。但是,当将其用作在 AWS 上运行的 Graal 本机映像时,它会失败并显示:
io.micronaut.context.exceptions.BeanInstantiationException:错误实例化类型为 [com.amazonaws.services.dynamodbv2.document.DynamoDB] 的 bean 消息:无法从 com/amazonaws/partitions/endpoints.json 加载分区元数据
我正在使用此依赖项:compile 'com.amazonaws:aws-java-sdk-dynamodb:1.11.504'
如何解决无法加载分区元数据错误?
完整日志:
Caused by: com.amazonaws.SdkClientException: Unable to load partition metadata from com/amazonaws/partitions/endpoints.json
at com.amazonaws.partitions.PartitionsLoader.build(PartitionsLoader.java:82)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.getRegionObject(AwsClientBuilder.java:256)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:245)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:232)
at com.codependent.micronaut.awslambda.configuration.DynamoDbConfiguration.dynamoDbClient(DynamoDbConfiguration.kt:18)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbClientDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
更新:
我错过了以下异常的嵌套原因:Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.amazonaws.partitions.model.Partitions (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
这是完整的堆栈跟踪:
START RequestId: c5998c1d-490b-4794-814e-82afbeb70fea Version: $LATEST
[36m23:10:58.905[0;39m [1;30m[main][0;39m [1;31mERROR[0;39m [35mi.m.f.a.p.AbstractLambdaContainerHandler[0;39m - Error while handling request
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [com.amazonaws.services.dynamodbv2.document.DynamoDB]
Message: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
Path Taken: new WarmUpController([PingService pingService]) --> new PingService([PingRepository pingRepository]) --> new PingRepository(Environment environment,[DynamoDB dynamoDb],DynamoDBMapper dynamoDbMapper) --> DynamoDB.dynamoDb([AmazonDynamoDB dynamoDbClient])
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1399)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.repository.$PingRepositoryDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.service.$PingServiceDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.web.$WarmUpControllerDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:550)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.getTarget(DefaultBeanContext.java:2522)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:2543)
at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:236)
at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
at io.micronaut.function.aws.proxy.MicronautLambdaContainerHandler.lambda$null$1(MicronautLambdaContainerHandler.java:240)
at io.reactivex.internal.operators.flowable.FlowableDefer.subscribeActual(FlowableDefer.java:35)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:481)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Caused by: com.amazonaws.SdkClientException: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:95)
at com.amazonaws.partitions.PartitionsLoader.build(PartitionsLoader.java:84)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.getRegionObject(AwsClientBuilder.java:256)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:245)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:232)
at com.codependent.micronaut.awslambda.configuration.DynamoDbConfiguration.dynamoDbClient(DynamoDbConfiguration.kt:18)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbClientDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
... 57 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.amazonaws.partitions.model.Partitions` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (ByteArrayInputStream); line: 2, column: 3]
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1452)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1028)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1297)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070)
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:92)
... 68 common frames omitted
[36m23:10:58.905[0;39m [1;30m[main][0;39m [1;31mERROR[0;39m [35mc.a.s.proxy.AwsProxyExceptionHandler[0;39m - Called exception handler for:
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [com.amazonaws.services.dynamodbv2.document.DynamoDB]
Message: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
Path Taken: new WarmUpController([PingService pingService]) --> new PingService([PingRepository pingRepository]) --> new PingRepository(Environment environment,[DynamoDB dynamoDb],DynamoDBMapper dynamoDbMapper) --> DynamoDB.dynamoDb([AmazonDynamoDB dynamoDbClient])
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1399)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.repository.$PingRepositoryDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.service.$PingServiceDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.web.$WarmUpControllerDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:550)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.getTarget(DefaultBeanContext.java:2522)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:2543)
at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:236)
at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
at io.micronaut.function.aws.proxy.MicronautLambdaContainerHandler.lambda$null$1(MicronautLambdaContainerHandler.java:240)
at io.reactivex.internal.operators.flowable.FlowableDefer.subscribeActual(FlowableDefer.java:35)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:481)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Caused by: com.amazonaws.SdkClientException: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:95)
at com.amazonaws.partitions.PartitionsLoader.build(PartitionsLoader.java:84)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.getRegionObject(AwsClientBuilder.java:256)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:245)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:232)
at com.codependent.micronaut.awslambda.configuration.DynamoDbConfiguration.dynamoDbClient(DynamoDbConfiguration.kt:18)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbClientDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
... 57 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.amazonaws.partitions.model.Partitions` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (ByteArrayInputStream); line: 2, column: 3]
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1452)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1028)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1297)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070)
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:92)
... 68 common frames omitted
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [com.amazonaws.services.dynamodbv2.document.DynamoDB]
Message: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
Path Taken: new WarmUpController([PingService pingService]) --> new PingService([PingRepository pingRepository]) --> new PingRepository(Environment environment,[DynamoDB dynamoDb],DynamoDBMapper dynamoDbMapper) --> DynamoDB.dynamoDb([AmazonDynamoDB dynamoDbClient])
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1399)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.repository.$PingRepositoryDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.service.$PingServiceDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:941)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:981)
at com.codependent.micronaut.awslambda.web.$WarmUpControllerDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:1972)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:1693)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1673)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:550)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.getTarget(DefaultBeanContext.java:2522)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:2543)
at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:236)
at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
at io.micronaut.function.aws.proxy.MicronautLambdaContainerHandler.lambda$null$1(MicronautLambdaContainerHandler.java:240)
at io.reactivex.internal.operators.flowable.FlowableDefer.subscribeActual(FlowableDefer.java:35)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14805)
at io.reactivex.Flowable.subscribe(Flowable.java:14752)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:68)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:481)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Caused by: com.amazonaws.SdkClientException: Error while loading partitions file from com/amazonaws/partitions/endpoints.json
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:95)
at com.amazonaws.partitions.PartitionsLoader.build(PartitionsLoader.java:84)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.getRegionObject(AwsClientBuilder.java:256)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:245)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:232)
at com.codependent.micronaut.awslambda.configuration.DynamoDbConfiguration.dynamoDbClient(DynamoDbConfiguration.kt:18)
at com.codependent.micronaut.awslambda.configuration.$DynamoDbConfiguration$DynamoDbClientDefinition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1385)
... 57 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.amazonaws.partitions.model.Partitions` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (ByteArrayInputStream); line: 2, column: 3]
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1452)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1028)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1297)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070)
at com.amazonaws.partitions.PartitionsLoader.loadPartitionFromStream(PartitionsLoader.java:92)
... 68 more
END RequestId: c5998c1d-490b-4794-814e-82afbeb70fea
REPORT RequestId: c5998c1d-490b-4794-814e-82afbeb70fea Duration: 107.89 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 59 MB
更新 2:
我还尝试在 reflect.json 中为 Partitions 类添加一个条目:
...
}, {
"name" : "com.amazonaws.partitions.model.Partitions",
"allPublicMethods" : true,
"allDeclaredConstructors" : true
}]