Hi all,

I am using apache ActiveMQ with the Spring framework.

Where we now trying to upgrade spring to 5.2 latest since its older
releases reach the end of life.

While upgrading spring, we got stuck with below exception.


2020-10-22 15:48:54,094 | ERROR | Failed to load: class path resource
[activemq.xml], reason: Error creating bean with name 'statusService'
defined in class path resource [activemq.xml]: Initialization of bean
failed; nested exception is java.lang.NoSuchMethodError:
org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z
| org.apache.activemq.xbean.XBeanBrokerFactory | main2020-10-22
15:48:54,094 | ERROR | Failed to load: class path resource
[activemq.xml], reason: Error creating bean with name 'statusService'
defined in class path resource [activemq.xml]: Initialization of bean
failed; nested exception is java.lang.NoSuchMethodError:
org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z
| org.apache.activemq.xbean.XBeanBrokerFactory |
mainorg.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'statusService' defined in class path resource
[activemq.xml]: Initialization of bean failed; nested exception is
java.lang.NoSuchMethodError:
org.springframework.core.annotation.AnnotationUtils.isCandidateClass(Ljava/lang/Class;Ljava/lang/Class;)Z
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:757)[spring-beans-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)[spring-context-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)[spring-context-4.3.26.RELEASE.jar:4.3.26.RELEASE]
at 
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)[xbean-spring-4.17.jar:4.17]
at 
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)[xbean-spring-4.17.jar:4.17]
at 
org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)[activemq-spring-5.16.0.jar:5.16.0]
at 
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)[activemq-spring-5.16.0.jar:5.16.0]
at 
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)[activemq-spring-5.16.0.jar:5.16.0]
at 
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)[activemq-broker-5.16.0.jar:5.16.0]
at 
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)[activemq-broker-5.16.0.jar:5.16.0]
at 
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)[activemq-console-5.16.0.jar:5.16.0]
at 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.16.0.jar:5.16.0]
at 
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)[activemq-console-5.16.0.jar:5.16.0]
at 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)[activemq-console-5.16.0.jar:5.16.0]
at 
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)[activemq-console-5.16.0.jar:5.16.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.8.0_242] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_242]
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_242]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_242] at
org.apache.activemq.console.Main.runTaskClass(Main.java:262)[activemq.jar:5.16.0]
at org.apache.activemq.console.Main.main(Main.java:115)[activemq.jar:5.16.0]

On further debugging, able to see below change is made in spring since 5.2
and it expects the same from ActiveMQ on runtime but which fails due to the
spring 4.3.26 reference.

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/annotation/AnnotationUtils.html#isCandidateClass-java.lang.Class-java.lang.Class

*Replacing the old spring jar with new makes to bypass the issue. But don't
know the impact of changing the dependency manually.*

Can you please upgrade the spring?

Raised same as ticket https://issues.apache.org/jira/browse/AMQ-8058


*Thanks and Regards,*

*Ragul*

Reply via email to