NoSuchMethodError: org.springframework.context.ApplicationContext.findAnnotationOnBean in JBoss EAP 5.x

Solution Verified - Updated -

Issue

  • We are able to run our webapp application on JBoss Developer Studio (JBDS) 4.0 without any issues on my local development environment. When I port the application to JBoss Enterprise Application Platform (EAP) 5.1.2, it is giving error " Initialization of bean failed; nested exception NoSuchMethod as shown below:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.context.ApplicationContext.findAnnotationOnBean(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
...
Caused by: java.lang.NoSuchMethodError: org.springframework.context.ApplicationContext.findAnnotationOnBean(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
  at org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping.determineUrlsForHandler(DefaultAnnotationHandlerMapping.java:108)
  at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:80)
  at org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.initApplicationContext(AbstractDetectingUrlHandlerMapping.java:58)
  at org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
  at org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:71)
  at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
  at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:70)
...

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.1.x
  • JBossWS CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.