Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12490

Camel-jms: ClassNotFoundException: org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory in Spring-Boot

    Details

    • Estimated Complexity:
      Unknown

      Description

      Not sure if this is a Camel bug, but I'm using activemq-camel 5.14.5 in a spring-boot 1.5.12 application.

      After upgrading from Camel 2.21.0 to 2.21.1 start-up fails with:

      2018-05-07 09:45:34.213 ERROR 7992 --- [  restartedMain] o.s.boot.SpringApplication               : Application startup failed
      
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.config.internalJmsListenerAnnotationProcessor' defined in class path resource [org/springframework/jms/annotation/JmsBootstrapConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor]: Factory method 'jmsListenerAnnotationProcessor' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/messaging/handler/annotation/support/MessageHandlerMethodFactory
      	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1071) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:225) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:703) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      	at de.telekom.dms.FlexKommBusinessServicesApplication.main(FlexKommBusinessServicesApplication.java:10) [classes/:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
      	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.12.RELEASE.jar:1.5.12.RELEASE]
      Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor]: Factory method 'jmsListenerAnnotationProcessor' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/messaging/handler/annotation/support/MessageHandlerMethodFactory
      	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	... 22 common frames omitted
      Caused by: java.lang.NoClassDefFoundError: org/springframework/messaging/handler/annotation/support/MessageHandlerMethodFactory
      	at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_121]
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_121]
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_121]
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_121]
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_121]
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_121]
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_121]
      	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_121]
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_121]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
      	at org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor.<init>(JmsListenerAnnotationBeanPostProcessor.java:103) ~[spring-jms-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.jms.annotation.JmsBootstrapConfiguration.jmsListenerAnnotationProcessor(JmsBootstrapConfiguration.java:47) ~[spring-jms-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.jms.annotation.JmsBootstrapConfiguration$$EnhancerBySpringCGLIB$$1878cc3d.CGLIB$jmsListenerAnnotationProcessor$1(<generated>) ~[spring-jms-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.jms.annotation.JmsBootstrapConfiguration$$EnhancerBySpringCGLIB$$1878cc3d$$FastClassBySpringCGLIB$$265c8d54.invoke(<generated>) ~[spring-jms-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at org.springframework.jms.annotation.JmsBootstrapConfiguration$$EnhancerBySpringCGLIB$$1878cc3d.jmsListenerAnnotationProcessor(<generated>) ~[spring-jms-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
      	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.16.RELEASE.jar:4.3.16.RELEASE]
      	... 23 common frames omitted
      Caused by: java.lang.ClassNotFoundException: org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_121]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_121]
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_121]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_121]
      	... 47 common frames omitted
      

      The cause is https://issues.apache.org/jira/browse/CAMEL-12447, because when I add

      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-messaging</artifactId>
      </dependency>
      

      everything works fine again.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                pascalschumacher Pascal Schumacher
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: