I'm trying to move axon from a SimpleCommandBus to a DistributedCommandBus with Eureka for service discovery.
I tried implementing this by going through the documentation provided under axon (https://docs.axoniq.io/reference-guide/extensions/spring-cloud)
When I try starting my application, I'm receiving an error with the message
Error creating bean with name '__axon-annotation-command-handler-bean-post-processor': Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
This is how I'm wiring up the distributed command bus:
public CommandRouter springCloudCommandRouter(DiscoveryClient discoveryClient, Registration localServiceInstance) {
return SpringCloudCommandRouter.builder()
.discoveryClient(discoveryClient)
.routingStrategy(new AnnotationRoutingStrategy(STATIC_KEY))
.localServiceInstance(localServiceInstance)
.build();
}
@Bean
public CommandBusConnector springHttpCommandBusConnector(
@Qualifier("localSegment") CommandBus localSegment,
RestOperations restOperations,
Serializer serializer) {
return SpringHttpCommandBusConnector.builder()
.localCommandBus(localSegment)
.restOperations(restOperations)
.serializer(serializer)
.build();
}
@Primary
@Bean
public DistributedCommandBus springCloudDistributedCommandBus(
CommandRouter commandRouter,
CommandBusConnector commandBusConnector) {
return DistributedCommandBus.builder()
.commandRouter(commandRouter)
.connector(commandBusConnector)
.build();
}
After starting my application with this, I'm receiving the following error message.
2019-07-04T14:02:39.079+05:30 [APP/PROC/WEB/0] [OUT] 2019-07-04 08:32:39.079 WARN 17 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '__axon-annotation-command-handler-bean-post-processor': Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
2019-07-04T14:02:39.100+05:30 [APP/PROC/WEB/0] [OUT] Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-07-04T14:02:39.100+05:30 [APP/PROC/WEB/0] [OUT] 2019-07-04 08:32:39.099 INFO 17 --- [ main] ConditionEvaluationReportLoggingListener :
2019-07-04T14:02:39.106+05:30 [APP/PROC/WEB/0] [OUT] 2019-07-04 08:32:39.106 ERROR 17 --- [ main] o.s.boot.SpringApplication : Application run failed
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] ... 23 common frames omitted
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1331)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1471)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1491)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:248)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:174)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:177)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:294)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.CachedIntrospectionResults.buildGenericTypeAwarePropertyDescriptor(CachedIntrospectionResults.java:359)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:106)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.core.GenericTypeResolver.resolveParameterType(GenericTypeResolver.java:61)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.core.ResolvableType.resolveMethodParameter(ResolvableType.java:1297)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.core.ResolvableType.as(ResolvableType.java:443)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at org.springframework.core.ResolvableType.getSuperType(ResolvableType.java:453)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at java.lang.Class.getGenericSuperclass(Class.java:777)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51)
2019-07-04T14:02:39.107+05:30 [APP/PROC/WEB/0] [OUT] at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
The dependencies which we are using in our spring boot app is as
<spring-boot.version>2.0.6.RELEASE</spring-boot.version>
<spring.cloud.version>Finchley.RELEASE</spring.cloud.version>
<axon.version>4.0</axon.version>
<axon-spring-boot-starter.version>${axon.version}</axon-spring-boot-starter.version>
<axon-springcloud.version>4.0</axon-springcloud.version>
<axon-distributed-commandbus-springcloud.version>3.4.3</axon-distributed-commandbus-springcloud.version>
UPDATE: We tried bumping our axon version to 4.1.2, we are now encountering a 404 error. Stack trace below:
2019-07-17 07:02:48.815 DEBUG [test-app,65da6028861139c5,150e2f6a196c6ce8,false] 19 --- [http-nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Written [{timestamp=Wed Jul 17 07:02:48 UTC 2019, status=404, error=Not Found, message=No message available, path=/spring-command-bus-connector/command}]
We also tried moving the command router from SpringCloudCommandRouter -> SpringCloudHttpBackupCommandRouter, but to no avail. Any help on this would be greatly appreciated.