org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'campaignRedirectsController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping com.sdl.webapp.common.controller.BaseController.requestMappingHandlerMapping; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'pageController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() to {[/system/mvc/Shared/Error/SectionError],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'campaignRedirectsController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() mapped.

Tridion | Saurabh Jha | 8 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Could not autowire field in custom controller

    Tridion | 8 months ago | Saurabh Jha
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'campaignRedirectsController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping com.sdl.webapp.common.controller.BaseController.requestMappingHandlerMapping; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'pageController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() to {[/system/mvc/Shared/Error/SectionError],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'campaignRedirectsController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() mapped.

    1 unregistered visitors

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Ambiguous mapping found. Cannot map 'pageController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() to {[/system/mvc/Shared/Error/SectionError],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'campaignRedirectsController' bean method public java.lang.String com.sdl.webapp.common.controller.BaseController.handleJspIncludesErrors() mapped.

      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod()
    2. Spring MVC
      AbstractHandlerMethodMapping.afterPropertiesSet
      1. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:179)
      2. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:145)
      3. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:107)
      4. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:87)
      4 frames
    3. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1631)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      5. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      6. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      7. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      9. org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
      10. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
      11. org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
      12. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
      13. org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
      14. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
      15. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
      16. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      17. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      18. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      19. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      20. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      21. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      22. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
      22 frames
    4. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:759)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      2 frames
    5. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388)
      2. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
      3. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
      3 frames
    6. Glassfish Core
      HostConfig$DeployDirectory.run
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
      2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
      3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      4. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
      5. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
      6. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
      7. org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
      8. org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1786)
      8 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      2. java.util.concurrent.FutureTask.run(Unknown Source)
      3. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      5. java.lang.Thread.run(Unknown Source)
      5 frames