We have a number of services that all share a single service template as a dependency. We would like to include our Axon configuration in this dependency but on startup this is giving us a java.lang.LinkageError (in 15 years I think this is the first time that I’ve seen this error). The only solution that we have found is to remove Axon completely from our child project.
Stack trace follows
`
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of sun/misc/Launcher$AppClassLoader) previously initiated loading for a different type with name “org/axonframework/commandhandling/SimpleCommandBus”
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_181]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_181]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_181]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[?:1.8.0_181]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[?:1.8.0_181]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[?:1.8.0_181]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[?:1.8.0_181]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_181]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[?:1.8.0_181]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_181]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[?:1.8.0_181]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_181]
at com.capitalone.base.config.RoboAxonFactory.registerMetaDataInterceptors(RoboAxonFactory.java:24) ~[axon-bug-child-0.0.3.jar:?]
at com.capitalone.customer.config.AxonConfiguration.registerMetaDataInterceptors(AxonConfiguration.java:28) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:699) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)
`
My dependency tree looks somthing like:
`
±-- com.capitalone.customer:linkage-error-bug-parent:0.0.3
±-- com.capitalone.base:linkage-error-bug-child:0.0.3
-– org.axonframework:axon-spring-boot-starter:3.3.2
… …
`
Has anyone seen anything like this before?
Thanks!
Dave Garred