当前位置: 首页 > 知识库问答 >
问题:

使用DynamoDB和Graal自定义运行时抛出的Micronaut无服务器应用程序无法构造com实例。亚马逊。分区。模型分区

容学林
2023-03-14

此处提供的示例项目:https://github.com/codependent/micronaut-aws-lambda-proxy-graal

我在Amazon AWS上部署了一个Micronaut应用程序,作为Lambda函数。它被编译成GraalVM本机映像,并使用AWS Lambda自定义运行时运行。

如果应用程序不使用DynamoDB,它将运行平稳。当配置它并作为普通Java应用程序启动时,它也可以正常工作。但是,将其用作AWS上运行的Graal本机映像时,会出现以下问题:

伊奥。微型机器人。上下文例外。BeanInstationException:实例化[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)

更新:

我错过了以下异常的嵌套原因:原因:com.fasterxml.jackson.databind.exc.Invalid定义异常:无法构造com.amazonaws.partitions.model.分区的实例(不存在像默认构造一样的创建者):无法从对象值反序列化(没有基于委托或属性的创建者)

这是完整的堆栈跟踪:

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中为Partitions类添加一个条目。json:

...
}, {
  "name" : "com.amazonaws.partitions.model.Partitions",
  "allPublicMethods" : true,
  "allDeclaredConstructors" : true
}]

共有3个答案

何玺
2023-03-14

如果可以,您应该升级到AWS SDK v2。升级后的库解决了这些问题中的大部分,您几乎不需要进行任何配置即可使其正常工作。

我几乎让AWS SDK v1工作,然后我意识到我使用了错误的依赖项。

以我的身材。gradle dependencies block我把它们放在盒子里,它是开箱即用的:

   implementation platform("software.amazon.awssdk:bom:2.17.+")
   implementation "io.micronaut.aws:micronaut-aws-sdk-v2:3.0.+"
   implementation "software.amazon.awssdk:lambda"
空俊语
2023-03-14

静态资源不会自动包含在本机映像中。您可能必须修改本机图像命令,以包括com/amazonaws/分区/endpoints.json-H:包括资源

唐烨煜
2023-03-14

由于Graal Github问题的迹象,这一问题最终得以解决。

总结:

>

  • -H:包含资源="logback.xml|application.yml|com/amazonaws/分区/endpoints.json"

    在reflect中添加这些条目。json:

    反映json:

     , {
      "name" : "com.amazonaws.partitions.model.Partitions",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "com.amazonaws.partitions.model.Partition",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "com.amazonaws.partitions.model.Endpoint",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "com.amazonaws.partitions.model.Region",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "com.amazonaws.partitions.model.Service",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "com.amazonaws.partitions.model.CredentialScope",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }, {
      "name" : "java.util.HashSet",
      "allPublicMethods" : true,
      "allDeclaredConstructors" : true
    }
    

  •  类似资料:
    • 我的服务类中出现空指针异常。我有一个名为IAmazonUtilService的自动连线myservice类。但它面临着null pointervexception。 另外,我写了属性Util从application.properties读取数据,这也是不工作的。请帮帮我。 重要的Amazon数据ervice.java Git链接:https://github.com/Ezhilarasu1330/

    • 我试图使用亚马逊阿列克谢技能工具包(ASK)实现自定义技能。我配置了亚马逊Alexa语音服务(AVS)和ASK项目,然后创建lambda功能也。 我有两个习惯意图。 我有一个类似下面的句子 fIntent获取信息 这是我的索引。js代码 现在的问题是,当我说技能名称时,我收到了LaunchRequest消息。但是,当我试图通过说fIntent info来获取自定义意图值时,我并没有得到我在索引中配

    • 我使用Graal和Micronaut构建了一个原生java AWS Lambda函数,如下所述 将其部署到AWS Lambda(自定义运行时)后,我无法成功执行它。 AWS显示的错误是: AWS日志输出为: 但是当我使用本地测试它时 我得到了 功能代码为: UserDataService是: 为了在AWS控制台上测试它,我配置了以下测试事件: 注:我向AWS Lambda上传了一个zip文件,其中

    • 问题内容: 我正在使用Jackson,但遇到问题,当我尝试反序列化对象时,出现以下错误: 我在属性中遇到问题: 有人可以帮我吗? 问题答案: 您不能实例化一个抽象类,杰克逊也不能。您应该为Jackson提供有关如何使用具体类型实例化MyAbstractClass的信息。

    • 我已按照此处描述的所有步骤操作,当我运行 exec 命令时,我看到了以下角色: 但我的容器仍然无法加载: 原因:com . amazonaws . sdkclientexception:无法从链中的任何提供程序加载aws凭据:[EnvironmentVariableCredentialsProvider:无法从环境变量(AWS_ACCESS_KEY_ID(或AWS_ACCESS_KEY)和AWS_

    • 我读过一些帖子,说亚马逊应用程序使用webviews相当多 (来源:https://www.quora.com/why-does-the-Amazon-app-use-webview-in-and-ios-application和https://www.teamblind.com/post/Amazon-app-webviews-cut4sn6c) 现在,我曾经在android中玩过webview