Thanks for the quick reply Claus.

That did indeed help. It seems we must then change any existing routes declared 
as 'from("servlet:http://0.0.0.0:9080/test/endpoint3";)' instead of 
'from("undertow:http://0.0.0.0:9080/test/endpoint3";)'.

The camel-hystrix-starter does need to be removed now though. It results in the 
following error:

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=null; 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=null; autowireMode=3; dependencyCheck=0; 
autowireCandidate=true; primary=false; 
factoryBeanName=org.apache.camel.component.hystrix.springboot.HystrixMappingAutoConfiguration;
 factoryMethodName=servletRegistrationBean; initMethodName=null; 
destroyMethodName=(inferred); defined in class path resource 
[org/apache/camel/component/hystrix/springboot/HystrixMappingAutoConfiguration.class]]
 bound.

It works if I change back to the "regular" camel-hystrix dependency. Would that 
be correct?

Kind regards
Jesper Duelund Isaksen

-----Original Message-----
From: Claus Ibsen <claus.ib...@gmail.com> 
Sent: 28. januar 2021 13:30
To: users@camel.apache.org
Subject: Re: Spring Boot, Apache Camel and Undertow

Hi

You should use camel-servlet-starter to tie to the undertow from spring boot 
itself.

On Thu, Jan 28, 2021 at 11:53 AM Jesper Duelund Isaksen 
<jesper.duelund.isak...@systematic.com.invalid> wrote:
>
> Hello,
>
> In my team we are currently attempting to develop a Spring Boot 2.4.2 gateway 
> application which uses Apache Camel 3.7.1 to expose generic http routes using 
> the Undertow component and routes using the REST DSL.
>
> I assume that we are not correctly configuring the application since given 
> the pom.xml below and having manually configured the RestComponent to use 
> undertow as consumer, it seems two embedded Undertow instances are started. 
> The logs below show this.
> When the test run they fail since they expect the endpoints to be found on 
> port 9080.
>
> Does anyone know what we are doing wrong or misconfiguring in this case?
>
> 2021-01-28 11:33:10.741  INFO 13246 --- [           main] io.undertow         
>                      : starting server: Undertow - 2.2.3.Final
> 2021-01-28 11:33:10.854  INFO 13246 --- [           main] 
> o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 9080 
> (http)
> ...
> 2021-01-28 11:33:11.194  INFO 13246 --- [           main] 
> o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on 
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A0%2F&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426843386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=58N4TgoVBiZ3hGgEox7ay%2BaK8J6CueM51d84VSgffZ0%3D&amp;reserved=0
> 2021-01-28 11:33:11.194  INFO 13246 --- [           main] io.undertow         
>                      : starting server: Undertow - 2.2.3.Final
> 2021-01-28 11:33:11.198  INFO 13246 --- [           main] 
> o.a.c.i.e.InternalRouteStartupManager    : Route: rest-endpoint1 started and 
> consuming from: 
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A0%2Ftest%2Fendpoint1&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426843386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=dMQ4vDeunBrvNA%2FVCORVrtg2%2BrwB6dQHT1dVftTeCUs%3D&amp;reserved=0
> 2021-01-28 11:33:11.198  INFO 13246 --- [           main] 
> o.a.c.i.e.InternalRouteStartupManager    : Route: rest-endpoint2 started and 
> consuming from: 
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A0%2Ftest%2Fendpoint2&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426843386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=IdD9tEPaj%2FuQIk3%2F%2F7MR%2BpiC8hZoabugyfEy7r%2B6Bw8%3D&amp;reserved=0
> ...
> Tests running ...
> ...
> 2021-01-28 11:33:11.691  INFO 13246 --- [ - ShutdownTask] 
> o.a.c.c.undertow.DefaultUndertowHost     : Stopping Undertow server on 
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A0%2F&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=BdkXh4x2no%2FsGEQpmHGOZS9ZgrYKNna1GvNT5fbS7gg%3D&amp;reserved=0
> 2021-01-28 11:33:11.691  INFO 13246 --- [ - ShutdownTask] io.undertow         
>                      : stopping server: Undertow - 2.2.3.Final
> ...
> 2021-01-28 11:33:11.705  INFO 13246 --- [extShutdownHook] io.undertow         
>                      : stopping server: Undertow - 2.2.3.Final
>
>
>
> Maven pom.xml:
>
> <project 
> xmlns="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=%2FJIorhIHfTZjv4P%2BMC7xyoIJ3jTq9xL4CKTAN4DW8HQ%3D&amp;reserved=0";
>  
> xmlns:xsi="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=zTYin0PxiHitGTTLJ4YYZgEZgKB5hmFh2owMxm0A0to%3D&amp;reserved=0";
>  
> xsi:schemaLocation="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=%2FJIorhIHfTZjv4P%2BMC7xyoIJ3jTq9xL4CKTAN4DW8HQ%3D&amp;reserved=0
>  
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmaven.apache.org%2Fmaven-v4_0_0.xsd&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3VeNGq7YAoedG7ggnu7lsMMANG51D8rEDPPdNqQvv8o%3D&amp;reserved=0";>
>     <modelVersion>4.0.0</modelVersion>
>
>     <groupId>org.test.gateway-lib</groupId>
>     <artifactId>gateway-lib</artifactId>
>     <name>gateway-lib</name>
>     <version>1.0.0-SNAPSHOT</version>
>     <packaging>jar</packaging>
>
>     <properties>
>         <java.version>11</java.version>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>         
> <project.reporting.sourceEncoding>UTF-8</project.reporting.sourceEncoding>
>         <version.camel>3.7.1</version.camel>
>         <version.spring-boot>2.4.2</version.spring-boot>
>     </properties>
>
>     <dependencyManagement>
>         <dependencies>
>             <!-- Camel BOM -->
>             <dependency>
>                 <groupId>org.apache.camel.springboot</groupId>
>                 <artifactId>camel-spring-boot-dependencies</artifactId>
>                 <version>${version.camel}</version>
>                 <type>pom</type>
>                 <scope>import</scope>
>             </dependency>
>             <!-- Spring Boot BOM -->
>             <dependency>
>                 <groupId>org.springframework.boot</groupId>
>                 <artifactId>spring-boot-dependencies</artifactId>
>                 <version>${version.spring-boot}</version>
>                 <type>pom</type>
>                 <scope>import</scope>
>             </dependency>
>         </dependencies>
>     </dependencyManagement>
>
>     <dependencies>
>         <!-- Spring dependencies -->
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-web</artifactId>
>             <exclusions>
>                 <exclusion>
>                     <groupId>org.springframework.boot</groupId>
>                     <artifactId>spring-boot-starter-tomcat</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-undertow</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-cache</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-actuator</artifactId>
>         </dependency>
>
>         <!-- Camel dependencies -->
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-spring-boot-starter</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-servlet-starter</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-undertow-starter</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-metrics-starter</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-http-starter</artifactId>
>           </dependency>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-hystrix-starter</artifactId>
>         </dependency>
>
>         <!-- test -->
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-test</artifactId>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.camel</groupId>
>             <artifactId>camel-test-spring-junit5</artifactId>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>3.8.1</version>
>                 <configuration>
>                     <source>11</source>
>                     <target>11</target>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
>
>
> Kind regards
> Jesper Isaksen



--
Claus Ibsen
-----------------
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdavsclaus.com%2F&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=p3u5s%2BkkKEfbaQxTRVyVSP00eIGzS%2Bia01DoFtK7ErM%3D&amp;reserved=0
 @davsclaus Camel in Action 2: 
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.manning.com%2Fibsen2&amp;data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C0de09fb507ea49ff327708d8c3888655%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474338426853339%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=8rFJ7FrIidLgtUKJaNFoXWQ3KkUleatX5k8QCF9PLe4%3D&amp;reserved=0

Reply via email to