jboss-fuse / fuse-apicurito-generator

Fuse Apicurito Generator
5 stars 14 forks source link

mvn spring-boot:run --> Application startup failed #12

Closed tsedmik closed 5 years ago

tsedmik commented 6 years ago

Steps to reproduce:

  1. create a Fuse Integration project with fuse-apicurito-generator
  2. execute mvn clean package
  3. execute mvn spring-boot:run
  4. error: Failed to start route route2 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.

Workaround Change id of route2 in camel-context.xml file to something else (route21 for instance)

Log

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:7.2.0.fuse-720009:run (default-cli) > test-compile @ test >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- fabric8-maven-plugin:7.2.0.fuse-720009:resource (default) @ test ---
[WARNING] F8: Cannot access cluster for detecting mode: No route to host (Host unreachable)
[INFO] F8: Running in Kubernetes mode
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image fuse7/fuse-java-openshift:1.2 as base / builder
[INFO] F8: using resource templates from /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/src/main/fabric8
[INFO] F8: fmp-service: Adding a default service 'test' with ports [8080]
[INFO] F8: spring-boot-health-check: Adding readiness probe on port 8081, path='/health', scheme='HTTP', with initial delay 10 seconds
[INFO] F8: spring-boot-health-check: Adding liveness probe on port 8081, path='/health', scheme='HTTP', with initial delay 180 seconds
[INFO] F8: fmp-revision-history: Adding revision history limit to 2
[INFO] F8: f8-icon: Adding icon for deployment
[INFO] F8: f8-icon: Adding icon for service
[INFO] F8: validating /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/target/classes/META-INF/fabric8/openshift/test-deploymentconfig.yml resource
[WARNING] F8: Invalid Resource : /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/target/classes/META-INF/fabric8/openshift/test-deploymentconfig.yml
[message=.spec.template.spec.containers[0].resources.requests.cpu: string found, object expected, violation type=type]
[message=.spec.template.spec.containers[0].resources.limits.cpu: string found, object expected, violation type=type]
[INFO] F8: validating /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/target/classes/META-INF/fabric8/kubernetes/test-deployment.yml resource
[WARNING] F8: Invalid Resource : /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/target/classes/META-INF/fabric8/kubernetes/test-deployment.yml
[message=.spec.template.spec.containers[0].resources.limits.cpu: string found, object expected, violation type=type]
[message=.spec.template.spec.containers[0].resources.requests.cpu: string found, object expected, violation type=type]
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ test ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< spring-boot-maven-plugin:7.2.0.fuse-720009:run (default-cli) < test-compile @ test <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:7.2.0.fuse-720009:run (default-cli) @ test ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.13.RELEASE)

2018-10-19 15:38:22.299  INFO 27843 --- [           main] io.example.openapi.Application           : Starting Application on tsedmikntb with PID 27843 (/home/tsedmik/devel/git/fuse-apicurito-generator-tests/target/example/target/classes started by tsedmik in /home/tsedmik/devel/git/fuse-apicurito-generator-tests)
2018-10-19 15:38:22.302  INFO 27843 --- [           main] io.example.openapi.Application           : No active profile set, falling back to default profiles: default
2018-10-19 15:38:22.440  INFO 27843 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754: startup date [Fri Oct 19 15:38:22 CEST 2018]; root of context hierarchy
2018-10-19 15:38:23.384  INFO 27843 --- [           main] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [spring/camel-context.xml]
2018-10-19 15:38:25.637  INFO 27843 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$501df871] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-10-19 15:38:26.046  INFO 27843 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-10-19 15:38:26.090  INFO 27843 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2018-10-19 15:38:26.090  INFO 27843 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.36
2018-10-19 15:38:26.172  INFO 27843 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-10-19 15:38:26.172  INFO 27843 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3736 ms
2018-10-19 15:38:26.459  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-10-19 15:38:26.461  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'CamelServlet' to [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-10-19 15:38:26.465  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2018-10-19 15:38:26.466  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2018-10-19 15:38:27.095  INFO 27843 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754: startup date [Fri Oct 19 15:38:22 CEST 2018]; root of context hierarchy
2018-10-19 15:38:27.183  INFO 27843 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-10-19 15:38:27.184  INFO 27843 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-10-19 15:38:27.228  INFO 27843 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-19 15:38:27.228  INFO 27843 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-19 15:38:27.286  INFO 27843 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-19 15:38:27.389  INFO 27843 --- [           main] o.a.c.i.converter.DefaultTypeConverter   : Type converters loaded (core: 194, classpath: 7)
2018-10-19 15:38:28.622  INFO 27843 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-10-19 15:38:28.635  INFO 27843 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29e70b0d: startup date [Fri Oct 19 15:38:28 CEST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754
2018-10-19 15:38:28.669  INFO 27843 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'handlerExceptionResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=handlerExceptionResolver; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=endpointWebMvcChildContextConfiguration; factoryMethodName=compositeHandlerExceptionResolver; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.boot.actuate.autoconfigure.EndpointWebMvcChildContextConfiguration]
2018-10-19 15:38:28.717  INFO 27843 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8081 (http)
2018-10-19 15:38:28.718  INFO 27843 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2018-10-19 15:38:28.718  INFO 27843 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.36
2018-10-19 15:38:28.739  INFO 27843 --- [ost-startStop-1] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring embedded WebApplicationContext
2018-10-19 15:38:28.740  INFO 27843 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 105 ms
2018-10-19 15:38:28.744  INFO 27843 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-10-19 15:38:28.801  INFO 27843 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2018-10-19 15:38:28.818  INFO 27843 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.boot.actuate.endpoint.mvc.ManagementErrorEndpoint.invoke()
2018-10-19 15:38:28.826  INFO 27843 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-19 15:38:28.826  INFO 27843 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-19 15:38:28.844  INFO 27843 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29e70b0d: startup date [Fri Oct 19 15:38:28 CEST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754
2018-10-19 15:38:28.893  INFO 27843 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Loading additional Camel XML routes from: classpath:camel/*.xml
2018-10-19 15:38:28.894  INFO 27843 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Loading additional Camel XML rests from: classpath:camel-rest/*.xml
2018-10-19 15:38:28.916  INFO 27843 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.21.0.fuse-720024 (CamelContext: test) is starting
2018-10-19 15:38:28.917  INFO 27843 --- [           main] o.a.c.m.ManagedManagementStrategy        : JMX is enabled
2018-10-19 15:38:29.134  INFO 27843 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.21.0.fuse-720024 (CamelContext: test) is shutting down
2018-10-19 15:38:29.160  INFO 27843 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.21.0.fuse-720024 (CamelContext: test) uptime 0.244 seconds
2018-10-19 15:38:29.160  INFO 27843 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.21.0.fuse-720024 (CamelContext: test) is shutdown in 0.026 seconds
2018-10-19 15:38:29.162  INFO 27843 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
2018-10-19 15:38:29.172  INFO 27843 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
2018-10-19 15:38:29.190  INFO 27843 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-10-19 15:38:29.191  INFO 27843 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29e70b0d: startup date [Fri Oct 19 15:38:28 CEST 2018]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754
2018-10-19 15:38:29.201 ERROR 27843 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.
    at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) ~[camel-spring-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:369) ~[camel-spring-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:416) ~[camel-spring-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94) ~[camel-spring-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.createChildManagementContext(EndpointWebMvcAutoConfiguration.java:193) ~[spring-boot-actuator-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated(EndpointWebMvcAutoConfiguration.java:156) ~[spring-boot-actuator-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781) ~[spring-beans-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at io.example.openapi.Application.main(Application.java:31) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:527) [spring-boot-maven-plugin-1.5.13.RELEASE.jar:1.5.13.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.
    at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1132) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3729) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3443) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3251) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3247) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3270) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3247) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3163) ~[camel-core-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ~[camel-spring-2.21.0.fuse-720024.jar:2.21.0.fuse-720024]
    ... 31 common frames omitted

2018-10-19 15:38:29.202  INFO 27843 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1752c754: startup date [Fri Oct 19 15:38:22 CEST 2018]; root of context hierarchy
2018-10-19 15:38:29.203  INFO 27843 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
[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:527)
    at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.
    at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException (ObjectHelper.java:1830)
    at org.apache.camel.spring.SpringCamelContext.start (SpringCamelContext.java:136)
    at org.apache.camel.spring.CamelContextFactoryBean.start (CamelContextFactoryBean.java:369)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent (CamelContextFactoryBean.java:416)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent (CamelContextFactoryBean.java:94)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener (SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener (SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:393)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:399)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:347)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh (AbstractApplicationContext.java:883)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh (EmbeddedWebApplicationContext.java:144)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:546)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh (EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.createChildManagementContext (EndpointWebMvcAutoConfiguration.java:193)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated (EndpointWebMvcAutoConfiguration.java:156)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:781)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:867)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh (EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1107)
    at io.example.openapi.Application.main (Application.java:31)
    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:527)
    at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of duplicate id detected: route2. Please correct ids to be unique among all your routes.
    at org.apache.camel.impl.DefaultCamelContext.startRoute (DefaultCamelContext.java:1132)
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions (DefaultCamelContext.java:3729)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel (DefaultCamelContext.java:3443)
    at org.apache.camel.impl.DefaultCamelContext.access$000 (DefaultCamelContext.java:209)
    at org.apache.camel.impl.DefaultCamelContext$2.call (DefaultCamelContext.java:3251)
    at org.apache.camel.impl.DefaultCamelContext$2.call (DefaultCamelContext.java:3247)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader (DefaultCamelContext.java:3270)
    at org.apache.camel.impl.DefaultCamelContext.doStart (DefaultCamelContext.java:3247)
    at org.apache.camel.support.ServiceSupport.start (ServiceSupport.java:61)
    at org.apache.camel.impl.DefaultCamelContext.start (DefaultCamelContext.java:3163)
    at org.apache.camel.spring.SpringCamelContext.start (SpringCamelContext.java:133)
    at org.apache.camel.spring.CamelContextFactoryBean.start (CamelContextFactoryBean.java:369)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent (CamelContextFactoryBean.java:416)
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent (CamelContextFactoryBean.java:94)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener (SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener (SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent (SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:393)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:399)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent (AbstractApplicationContext.java:347)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh (AbstractApplicationContext.java:883)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh (EmbeddedWebApplicationContext.java:144)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:546)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh (EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.createChildManagementContext (EndpointWebMvcAutoConfiguration.java:193)
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration.afterSingletonsInstantiated (EndpointWebMvcAutoConfiguration.java:156)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons (DefaultListableBeanFactory.java:781)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:867)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh (EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run (SpringApplication.java:1107)
    at io.example.openapi.Application.main (Application.java:31)
    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:527)
    at java.lang.Thread.run (Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.884 s
[INFO] Finished at: 2018-10-19T15:38:29+02:00
[INFO] Final Memory: 67M/899M
[INFO] ------------------------------------------------------------------------
tsedmik commented 6 years ago

@bfitzpat Could you please take a look at this one ;-)

bfitzpat commented 6 years ago

@tsedmik - Can you provide the swagger file you used to generate the project?

tsedmik commented 5 years ago

@bfitzpat I'm using https://github.com/tsedmik/fuse-apicurito-generator-tests/blob/master/src/test/resources/openapi-spec.json

bfitzpat commented 5 years ago

@chirino do you have any ideas on this one? I'm out of my depth when it comes to actually running this stuff. Guessing (will look deeper on Monday) that it's due to the ID generation.

apupier commented 5 years ago

the generated file that I have with https://github.com/tsedmik/fuse-apicurito-generator-tests/blob/master/src/test/resources/openapi-spec.json is

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring       http://camel.apache.org/schema/spring/camel-spring.xsd">

    <camelContext id="context1" xmlns="http://camel.apache.org/schema/spring">

        <onException>
            <exception>java.lang.Exception</exception>
            <handled><constant>true</constant></handled>
            <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
                <constant>500</constant>
            </setHeader>
            <setBody>
                <simple>${exception.message}</simple>
            </setBody>
        </onException>

        <restConfiguration component="servlet" apiContextPath="/openapi.json"/>

        <rest id="rest1" path="/" enableCORS="true">
            <get id="openapi.json" produces="application/json" uri="openapi.json">
                <description>Gets the openapi document for this service</description>
                <route id="rest1-route1">
                    <setHeader id="setHeader-route1" headerName="Exchange.CONTENT_TYPE">
                        <constant>application/vnd.oai.openapi+json</constant>
                    </setHeader>
                    <setBody id="setBody-route1">
                        <simple>resource:classpath:openapi.json</simple>
                    </setBody>
                </route>
            </get>
        </rest>

        <rest id="rest2" path="" bindingMode="json" enableCORS="true">
            <get uri="/test">
                <to uri="direct:rest1"/>
            </get>
        </rest>

        <route id="route-">
            <from id="from-" uri="direct:rest1"/>
            <to id="to-" uri="direct:501"/>
        </route>

        <route id="route2">
            <from id="from-route2" uri="direct:501"/>
            <log id="log-route2" message="API operation not yet implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}"/>
            <setHeader id="setHeader-route2" headerName="Exchange.HTTP_RESPONSE_CODE">
                <constant>501</constant>
            </setHeader>
            <setBody id="setBody-route2">
                <simple>API operation not implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}</simple>
            </setBody>
        </route>

    </camelContext>
</beans>

it contains a single id "route2"

apupier commented 5 years ago

here is the generated zip with missing repositories added and fixed versions for Fuse/Camel example-fixedVersionsAndRepositories.zip

there is a single route2 declared so looks alike a bug in Camel itself. Where does this other route2 comes from?

apupier commented 5 years ago

I reported https://issues.apache.org/jira/browse/CAMEL-12908 upstream

it migth be that Camel is auto-generated some ids without taking care of provided ones. In this case a workaround could be to change the id that we generate and use another pattern.

bfitzpat commented 5 years ago

Very strange. Was just getting back to this so thanks for taking a look. I will look at changing the Id pattern in the meantime.

bfitzpat commented 5 years ago

I've updated ID generation to be a bit more thorough... @tsedmik can you try this? `<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

<camelContext id="context-6ebd1fc8-dcce-4fbf-9954-4fa38d165b91" xmlns="http://camel.apache.org/schema/spring">

    <onException>
        <exception>java.lang.Exception</exception>
        <handled><constant>true</constant></handled>
        <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
            <constant>500</constant>
        </setHeader>
        <setBody>
            <simple>${exception.message}</simple>
        </setBody>
    </onException>

    <restConfiguration component="servlet" apiContextPath="/openapi.json"/>

    <rest id="rest-7412c0d2-dc84-42c2-b7a0-053a269b92f6" path="/" enableCORS="true">
        <get id="openapi.json" produces="application/json" uri="openapi.json">
            <description>Gets the openapi document for this service</description>
            <route id="route-b70ff280-e0ef-444b-a587-67ac0fb5174d">
                <setHeader id="setHeader-85076671-a96e-4677-a905-dda01ca646f2" headerName="Exchange.CONTENT_TYPE">
                    <constant>application/vnd.oai.openapi+json</constant>
                </setHeader>
                <setBody id="setBody-9df299ac-980f-4372-a1dc-301643c96546">
                    <simple>resource:classpath:openapi.json</simple>
                </setBody>
            </route>
        </get>
    </rest>

    <rest id="rest-7ac4a9eb-84f8-4792-b8fe-eb3567184b98" path="" bindingMode="json" enableCORS="true">
        <get uri="/test">
            <to uri="direct:rest1"/>
        </get>
    </rest>

    <route id="route-56154203-290d-418d-a503-f36b01562c70">
        <from id="from-d4ac8949-6737-4663-9a16-b34f6552c0f9" uri="direct:rest1"/>
        <to id="to-9fb70bde-8510-48b0-bc38-878264718bdd" uri="direct:501"/>
    </route>

    <route id="route-96278acd-79de-41e7-8f01-dc09a609bad7">
        <from id="from-061efcf1-675b-4e20-920b-eabf9242bcb3" uri="direct:501"/>
        <log id="log-abf4b56d-037b-4c0a-a369-90504d840c23" message="API operation not yet implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}"/>
        <setHeader id="setHeader-df0d3c3e-2a96-4e73-8a70-f17d81c7e864" headerName="Exchange.HTTP_RESPONSE_CODE">
            <constant>501</constant>
        </setHeader>
        <setBody id="setBody-803acca2-7d4a-41de-9b3e-fdaf4176b85c">
            <simple>API operation not implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}</simple>
        </setBody>
    </route>

</camelContext>

`

bfitzpat commented 5 years ago

I'm worried about the which should probably refer to rest-7412c0d2-dc84-42c2-b7a0-053a269b92f6, but I'm not sure how to stash a value for later use in the template... Figuring that out.

bfitzpat commented 5 years ago

So locally I was able to use the changes I made here - https://github.com/jboss-fuse/fuse-apicurito-generator/pull/18 - along with the json file here - https://github.com/tsedmik/fuse-apicurito-generator-tests/blob/master/src/test/resources/openapi-spec.json - to generate a project, which I've attached here.

camel-project5.zip

This runs locally and no longer complains about "route2" so I think it was a matter of some IDs being out of whack.

bfitzpat commented 5 years ago

I had to change the project slightly with the updated version of the fuse bom and the additional repository definition to get it to work (thanks @apupier for the fixes in your earlier zip), but I think if we can figure out why the CI builds are failing on that PR (unrelated error it seems) I think we'll be in good shape.

apupier commented 5 years ago

This runs locally and no longer complains about "route2" so I think it was a matter of some IDs being out of whack.

yes, the issue has been confirmed on Camel side https://issues.apache.org/jira/browse/CAMEL-12908

apupier commented 5 years ago

I think if we can figure out why the CI builds are failing on that PR (unrelated error it seems) I think we'll be in good shape.

see https://github.com/jboss-fuse/fuse-apicurito-generator/pull/18#issuecomment-435773223

bfitzpat commented 5 years ago

Merged https://github.com/jboss-fuse/fuse-apicurito-generator/pull/18

bfitzpat commented 5 years ago

@tsedmik Do you want me to leave this open until you verify it?

tsedmik commented 5 years ago

@bfitzpat Great. Thank you for the fix. I'll check it and close it afterward

tsedmik commented 5 years ago

verified with master branch