You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tobias Letschka <tl...@covernet.de> on 2019/12/09 14:12:13 UTC

Undertow server starts twice - camel 2.23.0

Hi,

I have this route and the problem:

019-12-09 15:00:44.673  INFO 82720 --- [           main] o.a.c.c.mongodb3.MongoDbEndpoint         : Initialising MongoDb endpoint: mongodb3://mongo?collection=magento.order.in.rest&database=genisys&operation=insert
2019-12-09 15:00:44.702  INFO 82720 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
2019-12-09 15:00:44.720  INFO 82720 --- [           main] o.a.c.util.jsse.SSLContextParameters     : Available providers: SUN version 1.8.
2019-12-09 15:00:45.070  INFO 82720 --- [           main] o.a.c.util.jsse.SSLContextParameters     : Available providers: SUN version 1.8.
2019-12-09 15:00:45.281  INFO 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on https://localhost:8443
2019-12-09 15:00:45.303  INFO 82720 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
2019-12-09 15:00:45.322  INFO 82720 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2019-12-09 15:00:45.442  INFO 82720 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: https://localhost:8443/v1/order?chunked=true&httpMethodRestrict=PUT%2COPTIONS&matchOnUriPrefix=false&optionsEnabled=true
2019-12-09 15:00:45.443  INFO 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on https://localhost:8443
2019-12-09 15:00:45.446  WARN 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Failed to start Undertow server on https://localhost:8443, reason: java.net.BindException: Address already in use

It starts twice.

RestControllerRouteBuilder:

// Setup
restConfiguration().apiContextRouteId("swagger")
    .component("undertow")
    .host("localhost")
    .port("{{http.port}}")
    .bindingMode(RestBindingMode.json)
    .scheme("https")
    .dataFormatProperty("prettyPrint", "true")
        .apiContextPath("/api-doc")
    .enableCORS(true)
    .corsHeaderProperty("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization")
    .apiContextPath("/v1/swagger")
        .apiProperty("api.title", "Order import API")
        .apiProperty("api.version", "1.0.0")
        .apiProperty("cors", "true")
    .endpointProperty("chunked", "true")
;

And this pom.xml

<dependencies>

  <!-- Spring-boot -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <!-- Exclude the Tomcat dependency -->
            <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>

<!-- Camel -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-swagger-java-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-servlet-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot-starter</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-jackson -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jackson</artifactId>
        <version>${camel.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-servlet</artifactId>
        <version>${camel.version}</version>
        <!-- use the same version as your Camel core version -->
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-mongodb3</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-camel</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-undertow</artifactId>
        <version>${camel.version}</version>
    </dependency>


    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-swagger-java</artifactId>
        <version>${camel.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-security</artifactId>
        <version>${camel.version}</version>
    </dependency>


    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-servlet</artifactId>
        <version>${camel.version}</version>
    </dependency>





    <!-- Database Migration -->
    <dependency>
        <groupId>com.github.mongobee</groupId>
        <artifactId>mongobee</artifactId>
        <version>${mongobee.version}</version>
    </dependency>

    <!-- Endpoints for Monitoring -->
   <!--
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>    -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>


    <!-- Dependencies for Tests -->
    <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</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- Other imports-->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
    </dependency>

</dependencies>

Maybe anybody can help me to fix this issue

Thx and kind regards

Tobias

Re: reactive streaming with camel and vertx

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah those options should be there, how are you starting and running Camel ?

On Wed, Dec 11, 2019 at 3:09 AM Bing Lu <mf...@yahoo.com.invalid> wrote:
>
>  Is vertx component a replacement of vertx camel bridge?
> when i did the following I got the following exception
> from("vertx:testchannel?host=127.0.0.1&port=7777").to("log:foo");
>
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: vertx://address?host=127.0.0.1&port=7777 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{host=127.0.0.1, port=7777}] at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:356) ~[camel-support-3.0.0.jar:3.0.0]
> but the docs say the following, how do i specify the host and port and channelname? please help, thanks
>
> URI FORMAT
> vertx:channelName[?options]
>
> |
> host (common)
>  |
> Hostname for creating an embedded clustered EventBus
>  |  |
> String
>  |
> |
> port (common)
>  |
> Port for creating an embedded clustered EventBus
>  |  |
> int
>  |
>
>
>
>     On Tuesday, December 10, 2019, 05:32:28 PM EST, Bing Lu <mf...@yahoo.com.invalid> wrote:
>
>   hi, there seems to be two way using reactive streaming with camel with vertx
> 1. using vertx camel bridge2. using vertx camel component
> what are the difference between the two and are there any examples of usage?
> thanks



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: reactive streaming with camel and vertx

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
if i have a verticle on one jvm how would i use the camel vertx component on another jvm consuming from the verticle on the other jvm? thanks

Sent from Yahoo Mail on Android 
 
  On Wed, Dec 11, 2019 at 11:39 AM, Bing Lu<mf...@yahoo.com.INVALID> wrote:   also if there is a vertx app deployed on another machine, i can still use the from(vertx:channelname)... right? given the host and port of the other machine

Sent from Yahoo Mail on Android 
 
  On Wed, Dec 11, 2019 at 7:33 AM, Bing Lu<mf...@yahoo.com.INVALID> wrote:  i am running it as a spring boot app

Sent from Yahoo Mail on Android 
 
  On Tue, Dec 10, 2019 at 9:09 PM, Bing Lu<mf...@yahoo.com.INVALID> wrote:  Is vertx component a replacement of vertx camel bridge?
when i did the following I got the following exception
from("vertx:testchannel?host=127.0.0.1&port=7777").to("log:foo"); 

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: vertx://address?host=127.0.0.1&port=7777 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{host=127.0.0.1, port=7777}] at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:356) ~[camel-support-3.0.0.jar:3.0.0]
but the docs say the following, how do i specify the host and port and channelname? please help, thanks

URI FORMAT
vertx:channelName[?options]

| 
host (common)
 | 
Hostname for creating an embedded clustered EventBus
 |  | 
String
 |
| 
port (common)
 | 
Port for creating an embedded clustered EventBus
 |  | 
int
 |



    On Tuesday, December 10, 2019, 05:32:28 PM EST, Bing Lu <mf...@yahoo.com.invalid> wrote:  
 
  hi, there seems to be two way using reactive streaming with camel with vertx
1. using vertx camel bridge2. using vertx camel component
what are the difference between the two and are there any examples of usage?
thanks       

Re: reactive streaming with camel and vertx

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
also if there is a vertx app deployed on another machine, i can still use the from(vertx:channelname)... right? given the host and port of the other machine

Sent from Yahoo Mail on Android 
 
  On Wed, Dec 11, 2019 at 7:33 AM, Bing Lu<mf...@yahoo.com.INVALID> wrote:   i am running it as a spring boot app

Sent from Yahoo Mail on Android 
 
  On Tue, Dec 10, 2019 at 9:09 PM, Bing Lu<mf...@yahoo.com.INVALID> wrote:  Is vertx component a replacement of vertx camel bridge?
when i did the following I got the following exception
from("vertx:testchannel?host=127.0.0.1&port=7777").to("log:foo"); 

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: vertx://address?host=127.0.0.1&port=7777 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{host=127.0.0.1, port=7777}] at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:356) ~[camel-support-3.0.0.jar:3.0.0]
but the docs say the following, how do i specify the host and port and channelname? please help, thanks

URI FORMAT
vertx:channelName[?options]

| 
host (common)
 | 
Hostname for creating an embedded clustered EventBus
 |  | 
String
 |
| 
port (common)
 | 
Port for creating an embedded clustered EventBus
 |  | 
int
 |



    On Tuesday, December 10, 2019, 05:32:28 PM EST, Bing Lu <mf...@yahoo.com.invalid> wrote:  
 
  hi, there seems to be two way using reactive streaming with camel with vertx
1. using vertx camel bridge2. using vertx camel component
what are the difference between the two and are there any examples of usage?
thanks      

Re: reactive streaming with camel and vertx

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
i am running it as a spring boot app

Sent from Yahoo Mail on Android 
 
  On Tue, Dec 10, 2019 at 9:09 PM, Bing Lu<mf...@yahoo.com.INVALID> wrote:   Is vertx component a replacement of vertx camel bridge?
when i did the following I got the following exception
from("vertx:testchannel?host=127.0.0.1&port=7777").to("log:foo"); 

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: vertx://address?host=127.0.0.1&port=7777 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{host=127.0.0.1, port=7777}] at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:356) ~[camel-support-3.0.0.jar:3.0.0]
but the docs say the following, how do i specify the host and port and channelname? please help, thanks

URI FORMAT
vertx:channelName[?options]

| 
host (common)
 | 
Hostname for creating an embedded clustered EventBus
 |  | 
String
 |
| 
port (common)
 | 
Port for creating an embedded clustered EventBus
 |  | 
int
 |



    On Tuesday, December 10, 2019, 05:32:28 PM EST, Bing Lu <mf...@yahoo.com.invalid> wrote:  
 
  hi, there seems to be two way using reactive streaming with camel with vertx
1. using vertx camel bridge2. using vertx camel component
what are the difference between the two and are there any examples of usage?
thanks     

Re: reactive streaming with camel and vertx

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
 Is vertx component a replacement of vertx camel bridge?
when i did the following I got the following exception
from("vertx:testchannel?host=127.0.0.1&port=7777").to("log:foo"); 

Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: vertx://address?host=127.0.0.1&port=7777 due to: There are 2 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{host=127.0.0.1, port=7777}] at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:356) ~[camel-support-3.0.0.jar:3.0.0]
but the docs say the following, how do i specify the host and port and channelname? please help, thanks

URI FORMAT
vertx:channelName[?options]

| 
host (common)
 | 
Hostname for creating an embedded clustered EventBus
 |  | 
String
 |
| 
port (common)
 | 
Port for creating an embedded clustered EventBus
 |  | 
int
 |



    On Tuesday, December 10, 2019, 05:32:28 PM EST, Bing Lu <mf...@yahoo.com.invalid> wrote:  
 
  hi, there seems to be two way using reactive streaming with camel with vertx
1. using vertx camel bridge2. using vertx camel component
what are the difference between the two and are there any examples of usage?
thanks    

reactive streaming with camel and vertx

Posted by Bing Lu <mf...@yahoo.com.INVALID>.
 hi, there seems to be two way using reactive streaming with camel with vertx
1. using vertx camel bridge2. using vertx camel component
what are the difference between the two and are there any examples of usage?
thanks  

Re: Undertow server starts twice - camel 2.23.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

When using Camel with spring boot, you should only use the -starter
dependencies in the pom.xml. eg dont have camel-servlet, but just
camel-servlet-starter and so on.

Also try upgrade to latest 2.23.x version or 2.24.x. See here about tips
https://camel.apache.org/community/support/

On Mon, Dec 9, 2019 at 3:12 PM Tobias Letschka <tl...@covernet.de> wrote:
>
> Hi,
>
> I have this route and the problem:
>
> 019-12-09 15:00:44.673  INFO 82720 --- [           main] o.a.c.c.mongodb3.MongoDbEndpoint         : Initialising MongoDb endpoint: mongodb3://mongo?collection=magento.order.in.rest&database=genisys&operation=insert
> 2019-12-09 15:00:44.702  INFO 82720 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Starting CamelMainRunController to ensure the main thread keeps running
> 2019-12-09 15:00:44.720  INFO 82720 --- [           main] o.a.c.util.jsse.SSLContextParameters     : Available providers: SUN version 1.8.
> 2019-12-09 15:00:45.070  INFO 82720 --- [           main] o.a.c.util.jsse.SSLContextParameters     : Available providers: SUN version 1.8.
> 2019-12-09 15:00:45.281  INFO 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on https://localhost:8443
> 2019-12-09 15:00:45.303  INFO 82720 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
> 2019-12-09 15:00:45.322  INFO 82720 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
> 2019-12-09 15:00:45.442  INFO 82720 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: route1 started and consuming from: https://localhost:8443/v1/order?chunked=true&httpMethodRestrict=PUT%2COPTIONS&matchOnUriPrefix=false&optionsEnabled=true
> 2019-12-09 15:00:45.443  INFO 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on https://localhost:8443
> 2019-12-09 15:00:45.446  WARN 82720 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Failed to start Undertow server on https://localhost:8443, reason: java.net.BindException: Address already in use
>
> It starts twice.
>
> RestControllerRouteBuilder:
>
> // Setup
> restConfiguration().apiContextRouteId("swagger")
>     .component("undertow")
>     .host("localhost")
>     .port("{{http.port}}")
>     .bindingMode(RestBindingMode.json)
>     .scheme("https")
>     .dataFormatProperty("prettyPrint", "true")
>         .apiContextPath("/api-doc")
>     .enableCORS(true)
>     .corsHeaderProperty("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization")
>     .apiContextPath("/v1/swagger")
>         .apiProperty("api.title", "Order import API")
>         .apiProperty("api.version", "1.0.0")
>         .apiProperty("cors", "true")
>     .endpointProperty("chunked", "true")
> ;
>
> And this pom.xml
>
> <dependencies>
>
>   <!-- Spring-boot -->
>     <dependency>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-starter-web</artifactId>
>         <exclusions>
>             <!-- Exclude the Tomcat dependency -->
>             <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>
>
> <!-- Camel -->
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-swagger-java-starter</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-servlet-starter</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-spring-boot-starter</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>     <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-jackson -->
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-jackson</artifactId>
>         <version>${camel.version}</version>
>         <scope>test</scope>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-servlet</artifactId>
>         <version>${camel.version}</version>
>         <!-- use the same version as your Camel core version -->
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-spring</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-core</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-mongodb3</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.activemq</groupId>
>         <artifactId>activemq-camel</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-undertow</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>
>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-swagger-java</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-spring-security</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>
>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-servlet</artifactId>
>         <version>${camel.version}</version>
>     </dependency>
>
>
>
>
>
>     <!-- Database Migration -->
>     <dependency>
>         <groupId>com.github.mongobee</groupId>
>         <artifactId>mongobee</artifactId>
>         <version>${mongobee.version}</version>
>     </dependency>
>
>     <!-- Endpoints for Monitoring -->
>    <!--
>    <dependency>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-starter-actuator</artifactId>
>     </dependency>    -->
>     <dependency>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-starter-security</artifactId>
>     </dependency>
>
>
>     <!-- Dependencies for Tests -->
>     <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</artifactId>
>         <scope>test</scope>
>     </dependency>
>
>     <!-- Other imports-->
>     <dependency>
>         <groupId>org.apache.httpcomponents</groupId>
>         <artifactId>httpcore</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>org.springframework</groupId>
>         <artifactId>spring-web</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>commons-codec</groupId>
>         <artifactId>commons-codec</artifactId>
>     </dependency>
>
> </dependencies>
>
> Maybe anybody can help me to fix this issue
>
> Thx and kind regards
>
> Tobias



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2