SAMPLE PROJECT AVAILABLE HERE: https://github.com/codependent/micronaut-aws-lambda-proxy-graal
I have a Micronaut application deployed on Amazon AWS as a Lambda function. It is compiled into a GraalVM native image and run using an AWS Lambda Custom Runtime.
If the application doesn't use DynamoDB it runs smoothly. When configuring it and starting as a normal Java application it also works OK. However when using it as a Graal native image running on AWS it fails with:
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [com.amazonaws.services.dynamodbv2.document.DynamoDB] Message: Unable to load partition metadata from com/amazonaws/partitions/endpoints.json
I'm using this dependency: compile 'com.amazonaws:aws-java-sdk-dynamodb:1.11.504'
How can I fix that unable to load partition metadata error?
Full log:
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)
UPDATE:
I missed the following nested cause of the exception: 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)
This is the full stacktrace:
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
UPDATE 2:
I've also tried adding an entry for the Partitions class in reflect.json:
...
}, {
"name" : "com.amazonaws.partitions.model.Partitions",
"allPublicMethods" : true,
"allDeclaredConstructors" : true
}]
This was finally solved thanks to the indications from this Graal Github issue.
Summing up:
-H:IncludeResources="logback.xml|application.yml|com/amazonaws/partitions/endpoints.json"
.
Adding these entries in reflect.json:
reflect.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
}