Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command handler interceptor causes errors in running Spring Boot AOT application #192

Closed
xvotro02 opened this issue Nov 2, 2024 · 3 comments

Comments

@xvotro02
Copy link

xvotro02 commented Nov 2, 2024

Basic information

  • Axon Framework version: 4.10.0
  • JDK version: JDK 21 (probably unrelated)
  • Spring (Boot) version: 3.3.0
  • Spring Ahead of Time Extension version: 4.10.0

Steps to reproduce

Define a command handler interceptor on aggregate.
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

Command handler interceptor works as in normal mode (without AOT and native image).

Actual behaviour

Error appears in running application when the interceptor should be executed:

The program tried to reflectively invoke method public void {aggregateClass}.intercept({command}) without it being registered for runtime reflection. Add public void {aggregateClass}.intercept({command}) to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
2024-09-30 13:29:33     at org.graalvm.nativeimage.builder/com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils.forQueriedOnlyExecutable(MissingReflectionRegistrationUtils.java:72)
2024-09-30 13:29:33     at [email protected]/java.lang.reflect.Method.acquireMethodAccessor(Method.java:77)
2024-09-30 13:29:33     at [email protected]/java.lang.reflect.Method.invoke(Method.java:577)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.AnnotatedMessageHandlingMember.handle(AnnotatedMessageHandlingMember.java:153)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.WrappedMessageHandlingMember.handle(WrappedMessageHandlingMember.java:64)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.WrappedMessageHandlingMember.handle(WrappedMessageHandlingMember.java:64)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.MessageHandlerInterceptorDefinition$InterceptedMessageHandlingMember.handle(MessageHandlerInterceptorDefinition.java:123)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.WrappedMessageHandlingMember.handle(WrappedMessageHandlingMember.java:64)
2024-09-30 13:29:33     at org.axonframework.tracing.TracingHandlerEnhancerDefinition$1.lambda$handle$1(TracingHandlerEnhancerDefinition.java:84)
2024-09-30 13:29:33     at org.axonframework.tracing.Span.runCallable(Span.java:132)
2024-09-30 13:29:33     at org.axonframework.tracing.TracingHandlerEnhancerDefinition$1.handle(TracingHandlerEnhancerDefinition.java:84)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.lambda$handle$0(AnnotatedCommandHandlerInterceptor.java:59)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.InterceptorChainParameterResolverFactory.callWithInterceptorChain(InterceptorChainParameterResolverFactory.java:75)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.handle(AnnotatedCommandHandlerInterceptor.java:56)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.lambda$handle$0(AnnotatedCommandHandlerInterceptor.java:60)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.InterceptorChainParameterResolverFactory.callWithInterceptorChain(InterceptorChainParameterResolverFactory.java:75)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.handle(AnnotatedCommandHandlerInterceptor.java:56)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.lambda$handle$0(AnnotatedCommandHandlerInterceptor.java:60)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.InterceptorChainParameterResolverFactory.callWithInterceptorChain(InterceptorChainParameterResolverFactory.java:75)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.handle(AnnotatedCommandHandlerInterceptor.java:56)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.lambda$handle$0(AnnotatedCommandHandlerInterceptor.java:60)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.InterceptorChainParameterResolverFactory.callWithInterceptorChain(InterceptorChainParameterResolverFactory.java:75)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.handle(AnnotatedCommandHandlerInterceptor.java:56)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.lambda$handle$0(AnnotatedCommandHandlerInterceptor.java:60)
2024-09-30 13:29:33     at org.axonframework.messaging.annotation.InterceptorChainParameterResolverFactory.callWithInterceptorChain(InterceptorChainParameterResolverFactory.java:75)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor.handle(AnnotatedCommandHandlerInterceptor.java:56)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.handle(AnnotatedAggregate.java:433)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.lambda$handle$3(AnnotatedAggregate.java:398)
2024-09-30 13:29:33     at org.axonframework.messaging.Scope.executeWithResult(Scope.java:111)
2024-09-30 13:29:33     at org.axonframework.modelling.command.inspection.AnnotatedAggregate.handle(AnnotatedAggregate.java:405)
2024-09-30 13:29:33     at org.axonframework.modelling.command.LockAwareAggregate.handle(LockAwareAggregate.java:97)
2024-09-30 13:29:33     at org.axonframework.modelling.command.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:568)
2024-09-30 13:29:33     at org.axonframework.modelling.command.AggregateAnnotationCommandHandler$AggregateCommandHandler.handle(AggregateAnnotationCommandHandler.java:557)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:57)
2024-09-30 13:29:33     at cz.aura.lis.axon.logging.MdcInterceptor.handle(MdcInterceptor.java:29)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.messaging.interceptors.CorrelationDataInterceptor.handle(CorrelationDataInterceptor.java:67)
2024-09-30 13:29:33     at org.axonframework.messaging.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:55)
2024-09-30 13:29:33     at org.axonframework.messaging.unitofwork.DefaultUnitOfWork.executeWithResult(DefaultUnitOfWork.java:77)
2024-09-30 13:29:33     at org.axonframework.commandhandling.SimpleCommandBus.lambda$handle$2(SimpleCommandBus.java:200)
2024-09-30 13:29:33     at org.axonframework.tracing.Span.runSupplier(Span.java:163)
2024-09-30 13:29:33     at org.axonframework.commandhandling.SimpleCommandBus.handle(SimpleCommandBus.java:191)
2024-09-30 13:29:33     at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:165)
2024-09-30 13:29:33     at org.axonframework.commandhandling.SimpleCommandBus.lambda$dispatch$1(SimpleCommandBus.java:131)
2024-09-30 13:29:33     at org.axonframework.tracing.Span.run(Span.java:101)
2024-09-30 13:29:33     at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:125)
2024-09-30 13:29:33     at org.axonframework.axonserver.connector.command.AxonServerCommandBus$CommandProcessingTask.lambda$run$1(AxonServerCommandBus.java:310)
2024-09-30 13:29:33     at org.axonframework.tracing.Span.run(Span.java:101)
2024-09-30 13:29:33     at org.axonframework.axonserver.connector.command.AxonServerCommandBus$CommandProcessingTask.run(AxonServerCommandBus.java:308)
2024-09-30 13:29:33     at org.axonframework.axonserver.connector.PriorityRunnable.run(PriorityRunnable.java:58)
2024-09-30 13:29:33     at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
2024-09-30 13:29:33     at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
2024-09-30 13:29:33     at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
2024-09-30 13:29:33     at [email protected]/java.lang.Thread.run(Thread.java:1583)
2024-09-30 13:29:33     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:902)
2024-09-30 13:29:33     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:878)
@smcvb
Copy link
Member

smcvb commented Nov 11, 2024

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.

@smcvb smcvb self-assigned this Nov 13, 2024
@smcvb smcvb added this to the Release 4.10.1 milestone Nov 13, 2024
@smcvb
Copy link
Member

smcvb commented Nov 13, 2024

I wanted to inform you that we're looking into this, @xvotro02. As stated earlier, as soon as we have a solution, we'll update this issue accordingly.

@smcvb
Copy link
Member

smcvb commented Nov 26, 2024

Closing this issue as it has been resolved in #197.

@smcvb smcvb closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants