You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Delgado, Michael" <Mi...@ista.com> on 2021/04/19 11:33:19 UTC

Camel dependency management issue (regarding reactor-core)

Hi everyone,

I had a problem in my spring boot application when updating from camel 3.8.0 to 3.9.0. My WebClient calls which uses .block(Duration) method (belonging to reactor-core artifact) do not work anymore.

Versioning:
Java 11.0.2.
Spring boot 2.4.4.
Camel 3.9.0.

My pom:
...
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.camel.springboot</groupId>
                <artifactId>camel-spring-boot-dependencies</artifactId>
                <version>3.9.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

   <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
...


Example of failing test:
...
  @Test
  void httpCallBlocking() {
    ResponseEntity<Void> response =
        WebClient.create()
            .get()
            .uri("http://www.google.es/")
            .retrieve()
            .toBodilessEntity()
            .block(Duration.ofSeconds(5));

    assertEquals(200, response.getStatusCodeValue());
  }
...


Output:
...
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.23 s <<< FAILURE! - in com.example.demo.DemoApplicationTests
[ERROR] httpCallBlocking  Time elapsed: 1.429 s  <<< ERROR!
java.lang.NoClassDefFoundError: reactor/util/context/ContextView
	at com.example.demo.DemoApplicationTests.httpCallBlocking(DemoApplicationTests.java:25)
Caused by: java.lang.ClassNotFoundException: reactor.util.context.ContextView
	at com.example.demo.DemoApplicationTests.httpCallBlocking(DemoApplicationTests.java:25)
...


It looks like camel 3.9.0 uses io.projectreactor:reactor-core:3.3.12-RELEASE, while 3.8.0 used io.projectreactor:reactor-core:3.4.4. I don't really know the reasons behind this downgrade.

Is it a camel dependency management issue or is it normal behavior? 

If I switch from camel-spring-boot-dependencies to camel-spring-boot-bom it works fine, since the non-camel dependencies are now managed by spring. Should I just use camel-spring-boot-bom? I would like to keep using camel-spring-boot-dependencies if possible.


Greetings.
Michael.

Re: Camel dependency management issue (regarding reactor-core)

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

Yes use camel-spring-boot-bom as its Spring Boot that fuckup when
there are class dependencies problems.
So its better to use what Spring Boot provides out of the box.

And we will upgrade reactor-core for Camel 3.10

On Mon, Apr 19, 2021 at 1:39 PM Delgado, Michael
<Mi...@ista.com> wrote:
>
> Hi everyone,
>
> I had a problem in my spring boot application when updating from camel 3.8.0 to 3.9.0. My WebClient calls which uses .block(Duration) method (belonging to reactor-core artifact) do not work anymore.
>
> Versioning:
> Java 11.0.2.
> Spring boot 2.4.4.
> Camel 3.9.0.
>
> My pom:
> ...
>     <dependencyManagement>
>         <dependencies>
>             <dependency>
>                 <groupId>org.apache.camel.springboot</groupId>
>                 <artifactId>camel-spring-boot-dependencies</artifactId>
>                 <version>3.9.0</version>
>                 <type>pom</type>
>                 <scope>import</scope>
>             </dependency>
>         </dependencies>
>     </dependencyManagement>
>
>    <dependencies>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-web</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-webflux</artifactId>
>         </dependency>
>
>         <dependency>
>             <groupId>org.apache.camel.springboot</groupId>
>             <artifactId>camel-spring-boot-starter</artifactId>
>         </dependency>
>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-test</artifactId>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
> ...
>
>
> Example of failing test:
> ...
>   @Test
>   void httpCallBlocking() {
>     ResponseEntity<Void> response =
>         WebClient.create()
>             .get()
>             .uri("http://www.google.es/")
>             .retrieve()
>             .toBodilessEntity()
>             .block(Duration.ofSeconds(5));
>
>     assertEquals(200, response.getStatusCodeValue());
>   }
> ...
>
>
> Output:
> ...
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.23 s <<< FAILURE! - in com.example.demo.DemoApplicationTests
> [ERROR] httpCallBlocking  Time elapsed: 1.429 s  <<< ERROR!
> java.lang.NoClassDefFoundError: reactor/util/context/ContextView
>         at com.example.demo.DemoApplicationTests.httpCallBlocking(DemoApplicationTests.java:25)
> Caused by: java.lang.ClassNotFoundException: reactor.util.context.ContextView
>         at com.example.demo.DemoApplicationTests.httpCallBlocking(DemoApplicationTests.java:25)
> ...
>
>
> It looks like camel 3.9.0 uses io.projectreactor:reactor-core:3.3.12-RELEASE, while 3.8.0 used io.projectreactor:reactor-core:3.4.4. I don't really know the reasons behind this downgrade.
>
> Is it a camel dependency management issue or is it normal behavior?
>
> If I switch from camel-spring-boot-dependencies to camel-spring-boot-bom it works fine, since the non-camel dependencies are now managed by spring. Should I just use camel-spring-boot-bom? I would like to keep using camel-spring-boot-dependencies if possible.
>
>
> Greetings.
> Michael.



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