Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-10835

SB2 - spring-boot-camel-rest-sql: servletRegistrationBean has already been defined

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • fuse-7.4-GA
    • fuse-7.4-GA
    • Examples, Spring Boot
    • None
    • % %

    Description

      https://github.com/fabric8-quickstarts/spring-boot-camel-rest-sql/tree/spring-boot-camel-rest-sql-1.0.fuse-sb2-740002
      mvn spring-boot:run

      [INFO] Scanning for projects...
      [INFO] 
      [INFO] ---------< io.fabric8.quickstarts:spring-boot-camel-rest-sql >----------
      [INFO] Building Fabric8 :: Quickstarts :: Spring-Boot :: Camel REST / SQL 1.0.fuse-sb2-740002
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO] 
      [INFO] >>> spring-boot-maven-plugin:7.4.0.fuse-sb2-740002:run (default-cli) > test-compile @ spring-boot-camel-rest-sql >>>
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-camel-rest-sql ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 4 resources
      [INFO] 
      [INFO] --- fabric8-maven-plugin:7.4.0.fuse-sb2-740002:resource (default) @ spring-boot-camel-rest-sql ---
      [INFO] F8: Using docker image name of namespace: llowinge
      [INFO] F8: Running generator spring-boot
      [INFO] F8: spring-boot: Using ImageStreamTag 'fuse7-java-openshift:1.4' from namespace 'openshift' as builder image
      [INFO] F8: using resource templates from /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/src/main/fabric8
      [INFO] F8: fmp-service: Adding a default service 'spring-boot-camel-rest-sql' with ports [8080]
      [INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
      [INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
      [INFO] F8: fmp-revision-history: Adding revision history limit to 2
      [INFO] F8: fmp-revision-history: Adding revision history limit to 2
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-rest-sql-deployment.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-rest-sql-service.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-rest-sql-route.yml resource
      [INFO] F8: using resource templates from /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/src/main/fabric8
      [INFO] F8: fmp-service: Adding a default service 'spring-boot-camel-rest-sql' with ports [8080]
      [INFO] F8: f8-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
      [INFO] F8: f8-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
      [INFO] F8: fmp-revision-history: Adding revision history limit to 2
      [INFO] F8: fmp-revision-history: Adding revision history limit to 2
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/openshift/spring-boot-camel-rest-sql-deploymentconfig.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/openshift/spring-boot-camel-rest-sql-service.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes/META-INF/fabric8/openshift/spring-boot-camel-rest-sql-route.yml resource
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ spring-boot-camel-rest-sql ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-camel-rest-sql ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 2 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ spring-boot-camel-rest-sql ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO] 
      [INFO] <<< spring-boot-maven-plugin:7.4.0.fuse-sb2-740002:run (default-cli) < test-compile @ spring-boot-camel-rest-sql <<<
      [INFO] 
      [INFO] 
      [INFO] --- spring-boot-maven-plugin:7.4.0.fuse-sb2-740002:run (default-cli) @ spring-boot-camel-rest-sql ---
      
        .   ____          _            __ _ _
       /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
      ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
       \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
        '  |____| .__|_| |_|_| |_\__, | / / / /
       =========|_|==============|___/=/_/_/_/
       :: Spring Boot ::        (v2.1.3.RELEASE)
      
      2019-06-14 10:08:10.346  INFO 31942 --- [           main] i.fabric8.quickstarts.camel.Application  : Starting Application on llowinge-mac with PID 31942 (/Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql/target/classes started by llowinge in /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel-rest-sql)
      2019-06-14 10:08:10.349  INFO 31942 --- [           main] i.fabric8.quickstarts.camel.Application  : The following profiles are active: dev
      2019-06-14 10:08:11.451  WARN 31942 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'servletRegistrationBean' defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.apache.camel.component.servlet.springboot.ServletMappingAutoConfiguration; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]] for bean 'servletRegistrationBean': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in io.fabric8.quickstarts.camel.Application] bound.
      2019-06-14 10:08:11.463  INFO 31942 --- [           main] ConditionEvaluationReportLoggingListener : 
      
      Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
      2019-06-14 10:08:11.465 ERROR 31942 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
      
      ***************************
      APPLICATION FAILED TO START
      ***************************
      
      Description:
      
      The bean 'servletRegistrationBean', defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class], could not be registered. A bean with that name has already been defined in io.fabric8.quickstarts.camel.Application and overriding is disabled.
      
      Action:
      
      Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
      
      [WARNING] 
      java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:528)
          at java.lang.Thread.run (Thread.java:748)
      Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'servletRegistrationBean' defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.apache.camel.component.servlet.springboot.ServletMappingAutoConfiguration; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]] for bean 'servletRegistrationBean': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in io.fabric8.quickstarts.camel.Application] bound.
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition (DefaultListableBeanFactory.java:897)
          at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod (ConfigurationClassBeanDefinitionReader.java:274)
          at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass (ConfigurationClassBeanDefinitionReader.java:141)
          at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions (ConfigurationClassBeanDefinitionReader.java:117)
          at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions (ConfigurationClassPostProcessor.java:327)
          at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry (ConfigurationClassPostProcessor.java:232)
          at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors (PostProcessorRegistrationDelegate.java:275)
          at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:95)
          at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors (AbstractApplicationContext.java:705)
          at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:531)
          at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:142)
          at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:775)
          at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:397)
          at org.springframework.boot.SpringApplication.run (SpringApplication.java:316)
          at org.springframework.boot.SpringApplication.run (SpringApplication.java:1260)
          at org.springframework.boot.SpringApplication.run (SpringApplication.java:1248)
          at io.fabric8.quickstarts.camel.Application.main (Application.java:34)
          at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:498)
          at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:528)
          at java.lang.Thread.run (Thread.java:748)
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 10.381 s
      [INFO] Finished at: 2019-06-14T10:08:11+02:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.jboss.redhat-fuse:spring-boot-maven-plugin:7.4.0.fuse-sb2-740002:run (default-cli) on project spring-boot-camel-rest-sql: An exception occurred while running. null: InvocationTargetException: Invalid bean definition with name 'servletRegistrationBean' defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.apache.camel.component.servlet.springboot.ServletMappingAutoConfiguration; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]] for bean 'servletRegistrationBean': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=application; factoryMethodName=servletRegistrationBean; initMethodName=null; destroyMethodName=(inferred); defined in io.fabric8.quickstarts.camel.Application] bound. -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      
      

      Attachments

        Issue Links

          Activity

            People

              yfang@redhat.com Freeman(Yue) Fang
              llowinge@redhat.com Lukas Lowinger
              Lukas Lowinger Lukas Lowinger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: