AxonFramework / extension-spring-aot

Axon Framework extension for Spring Ahead of Time compilation support.
Apache License 2.0
4 stars 0 forks source link

Aggregate member causes errors in running Spring Boot AOT application #193

Open xvotro02 opened 2 weeks ago

xvotro02 commented 2 weeks ago

Basic information

Steps to reproduce

Define an aggreagate with aggregate member (ForwardMatchingInstances, Map<id, MemberClass>, MemberClass has all getters and no args constructor, command is record).

Run Spring Boot application in native mode: a. mvn spring-boot:process-aot +java -DspringAot=true -jar your-application.jar b. org.graalvm.buildtools:native-maven-plugin + mvn spring-boot:build-image with maven native profile + run image

Expected behaviour

Aggregate member is processed as it is in normal mode (without AOT and native image).

Actual behaviour

Error appears in running application when the aggregate member is processed:

2024-09-30 12:30:01 10:30:01.701 WARN  o.a.m.command.AbstractRepository - Exception occurred while trying to load a aggregate with identifier
2024-09-30 12:30:01 java.lang.NullPointerException: null
2024-09-30 12:30:01     at org.axonframework.common.property.BeanPropertyAccessStrategy.getterName(BeanPropertyAccessStrategy.java:34)
2024-09-30 12:30:01     at org.axonframework.common.property.AbstractMethodPropertyAccessStrategy.propertyFor(AbstractMethodPropertyAccessStrategy.java:39)
2024-09-30 12:30:01     at org.axonframework.common.property.PropertyAccessStrategy.getProperty(PropertyAccessStrategy.java:91)
2024-09-30 12:30:01     at org.axonframework.modelling.command.ForwardMatchingInstances.filterCandidates(ForwardMatchingInstances.java:59)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AggregateMemberAnnotatedChildEntityMapDefinition.resolveEventTargets(AggregateMemberAnnotatedChildEntityMapDefinition.java:98)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AbstractChildEntityDefinition.lambda$createChildDefinition$1(AbstractChildEntityDefinition.java:72)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedChildEntity.publish(AnnotatedChildEntity.java:78)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory$AnnotatedAggregateModel.lambda$doPublish$20(AnnotatedAggregateMetaModelFactory.java:581)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory$AnnotatedAggregateModel.doPublish(AnnotatedAggregateMetaModelFactory.java:581)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory$AnnotatedAggregateModel.publish(AnnotatedAggregateMetaModelFactory.java:565)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.publish(AnnotatedAggregate.java:378)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcedAggregate.publish(EventSourcedAggregate.java:253)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.Iterator.forEachRemaining(Iterator.java:133)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcedAggregate.lambda$initializeState$0(EventSourcedAggregate.java:296)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.lambda$execute$2(AnnotatedAggregate.java:349)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AggregateLifecycle.lambda$execute$0(AggregateLifecycle.java:189)
2024-09-30 12:30:01     at org.axonframework.messaging.Scope.executeWithResult(Scope.java:111)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AggregateLifecycle.execute(AggregateLifecycle.java:188)
2024-09-30 12:30:01     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.execute(AnnotatedAggregate.java:349)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcedAggregate.initializeState(EventSourcedAggregate.java:293)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcingRepository.doLoadAggregate(EventSourcingRepository.java:158)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcingRepository.lambda$doLoadWithLock$0(EventSourcingRepository.java:138)
2024-09-30 12:30:01     at org.axonframework.tracing.Span.runSupplier(Span.java:163)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcingRepository.doLoadWithLock(EventSourcingRepository.java:138)
2024-09-30 12:30:01     at org.axonframework.eventsourcing.EventSourcingRepository.doLoadWithLock(EventSourcingRepository.java:56)
2024-09-30 12:30:01     at org.axonframework.modelling.command.LockingRepository.doLoad(LockingRepository.java:137)
2024-09-30 12:30:01     at org.axonframework.modelling.command.LockingRepository.doLoad(LockingRepository.java:60)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AbstractRepository.lambda$null$5(AbstractRepository.java:151)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.HashMap.computeIfAbsent(HashMap.java:1228)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AbstractRepository.lambda$load$7(AbstractRepository.java:148)
2024-09-30 12:30:01     at org.axonframework.tracing.Span.runSupplier(Span.java:163)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AbstractRepository.load(AbstractRepository.java:145)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:568)
2024-09-30 12:30:01     at org.axonframework.modelling.command.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:557)
2024-09-30 12:30:01     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:57)
2024-09-30 12:30:01     at cz.aura.lis.axon.logging.MdcInterceptor.handle(MdcInterceptor.java:29)
2024-09-30 12:30:01     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 12:30:01     at org.axonframework.messaging.interceptors.CorrelationDataInterceptor.handle(CorrelationDataInterceptor.java:67)
2024-09-30 12:30:01     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 12:30:01     at org.axonframework.messaging.unitofwork.DefaultUnitOfWork.executeWithResult(DefaultUnitOfWork.java:77)
2024-09-30 12:30:01     at org.axonframework.commandhandling.SimpleCommandBus.lambda$handle$2(SimpleCommandBus.java:200)
2024-09-30 12:30:01     at org.axonframework.tracing.Span.runSupplier(Span.java:163)
2024-09-30 12:30:01     at org.axonframework.commandhandling.SimpleCommandBus.handle(SimpleCommandBus.java:191)
2024-09-30 12:30:01     at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:165)
2024-09-30 12:30:01     at org.axonframework.commandhandling.SimpleCommandBus.lambda$dispatch$1(SimpleCommandBus.java:131)
2024-09-30 12:30:01     at org.axonframework.tracing.Span.run(Span.java:101)
2024-09-30 12:30:01     at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:125)
2024-09-30 12:30:01     at org.axonframework.axonserver.connector.command.AxonServerCommandBus$CommandProcessingTask.lambda$run$1(AxonServerCommandBus.java:310)
2024-09-30 12:30:01     at org.axonframework.tracing.Span.run(Span.java:101)
2024-09-30 12:30:01     at org.axonframework.axonserver.connector.command.AxonServerCommandBus$CommandProcessingTask.run(AxonServerCommandBus.java:308)
2024-09-30 12:30:01     at org.axonframework.axonserver.connector.PriorityRunnable.run(PriorityRunnable.java:58)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
2024-09-30 12:30:01     at java.base@21.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
2024-09-30 12:30:01     at java.base@21.0.4/java.lang.Thread.runWith(Thread.java:1596)
2024-09-30 12:30:01     at java.base@21.0.4/java.lang.Thread.run(Thread.java:1583)
2024-09-30 12:30:01     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:902)
2024-09-30 12:30:01     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:878)
smcvb commented 1 week ago

Thanks for filing this issue with us, @xvotro02! If you could have a sample application showing the behavior consistently, that would greatly help us resolve this issue soon. If not, it will take some time for us to set that up. This is doable, but it would thus take longer to get to a resolution, which I want you to be aware of.

Any progress on the issue will be shared here for your convenience.