[
https://issues.apache.org/jira/browse/SM-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Stoch updated SM-5023:
-----------------------------
Description:
I am trying to use spring-web and spring-webflux 5.3.15 bundle and
JettyClientHttpConnector class:
{code}
ClientHttpConnector connector = new JettyClientHttpConnector();
WebClient webClient =
WebClient.builder().clientConnector(connector).build();
final RequestHeadersSpec<?> spec =
webClient.get().uri("https://jsonplaceholder.typicode.com/comments");
spec.retrieve();
{code}
The first call raises an exception:
{noformat}
java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
...
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
cannot be found by org.apache.servicemix.bundles.spring-web_5.3.15.1
{noformat}
I think this spring-web bundle misses some (optional?) imports, eg.:
org.reactivestreams, org.eclipse.jetty.client. Maybe there are more missing
imports like: reactor.core.publisher, ...?
I have added these two imports to test:
{noformat}
org.reactivestreams
org.eclipse.jetty.client
{noformat}
And now an exception is raised in the second line of code above (WebClient
creation):
{noformat}
java.lang.NoClassDefFoundError: Could not initialize class
org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder
{noformat}
This last problem can be reproduced by calling:
{noformat}
ExchangeStrategies.withDefaults();
{noformat}
It looks like DefaultExchangeStrategiesBuilder is a class with package access
modifier so it is not visible from calling code.
was:
I am trying to use spring-web and spring-webflux 5.3.15 bundle and
JettyClientHttpConnector class:
{code}
ClientHttpConnector connector = new JettyClientHttpConnector();
WebClient webClient =
WebClient.builder().clientConnector(connector).build();
final RequestHeadersSpec<?> spec =
webClient.get().uri("https://jsonplaceholder.typicode.com/comments");
spec.retrieve();
{code}
The first call raises an exception:
{noformat}
java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
...
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
cannot be found by org.apache.servicemix.bundles.spring-web_5.3.15.1
{noformat}
I think this spring-web bundle misses some (optional?) imports, eg.:
org.reactivestreams, org.eclipse.jetty.client. Maybe there are more missing
imports like: reactor.core.publisher, ...?
I have added these two imports to test:
{noformat}
org.reactivestreams
org.eclipse.jetty.client
{noformat}
And now an exception is raised in the second line of code above (WebClient
creation):
{noformat}
java.lang.NoClassDefFoundError: Could not initialize class
org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder
{noformat}
> Spring-web and Spring-webflux miss some import packages
> -------------------------------------------------------
>
> Key: SM-5023
> URL: https://issues.apache.org/jira/browse/SM-5023
> Project: ServiceMix
> Issue Type: Bug
> Affects Versions: bundles-2022.01
> Reporter: Daniel Stoch
> Priority: Major
>
> I am trying to use spring-web and spring-webflux 5.3.15 bundle and
> JettyClientHttpConnector class:
> {code}
> ClientHttpConnector connector = new JettyClientHttpConnector();
> WebClient webClient =
> WebClient.builder().clientConnector(connector).build();
> final RequestHeadersSpec<?> spec =
> webClient.get().uri("https://jsonplaceholder.typicode.com/comments");
> spec.retrieve();
> {code}
> The first call raises an exception:
> {noformat}
> java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
> ...
> Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
> cannot be found by org.apache.servicemix.bundles.spring-web_5.3.15.1
> {noformat}
> I think this spring-web bundle misses some (optional?) imports, eg.:
> org.reactivestreams, org.eclipse.jetty.client. Maybe there are more missing
> imports like: reactor.core.publisher, ...?
> I have added these two imports to test:
> {noformat}
> org.reactivestreams
> org.eclipse.jetty.client
> {noformat}
> And now an exception is raised in the second line of code above (WebClient
> creation):
> {noformat}
> java.lang.NoClassDefFoundError: Could not initialize class
> org.springframework.web.reactive.function.client.DefaultExchangeStrategiesBuilder
> {noformat}
> This last problem can be reproduced by calling:
> {noformat}
> ExchangeStrategies.withDefaults();
> {noformat}
> It looks like DefaultExchangeStrategiesBuilder is a class with package access
> modifier so it is not visible from calling code.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)