These are chat archives for spring-cloud/spring-cloud

2nd
Mar 2018
Haruhiko Nishi
@hanishi
Mar 02 2018 00:51
Under 1.8.1 EurekaClient without Jerseyof the spring-cloud-netflix documentation, it states that Jersey dependencies can be excluded, but when application'sendpoints.refresh.enabled property is set to true, the application won't start due to missing class that is presumably part of the dependencies explicitly excluded. I am not sure if this is expected behavior.
Spencer Gibb
@spencergibb
Mar 02 2018 00:55
the two are unrelated. The refresh endpoint has no dependencies on jersey. What is the exception?
Haruhiko Nishi
@hanishi
Mar 02 2018 01:15
@spencergibb
2018-03-02 10:14:35.153 ERROR [euler-httpclient-processor-kafka,,,] 7548 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration': Unsatisfied dependency expressed through field 'optionalArgs'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'discoveryClientOptionalArgs' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.TypeNotPresentException: Type com.sun.jersey.api.client.filter.ClientFilter not present
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
    at org.springframework.cloud.stream.app.euler.httpclient.processor.kafka.EulerHttpclientProcessorKafka10Application.main(EulerHttpclientProcessorKafka10Application.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'discoveryClientOptionalArgs' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.TypeNotPresentException:
and here is my config
{"name":"euler-httpclient-processor-kafka","profiles":["transfer"],"label":null,"version":null,"state":null,"propertySources":[{"name":"euler-httpclient-processor-kafka-default","source":{"endpoints.refresh.enabled":"true","spring.redis.host":"127.0.0.1","spring.redis.port":"6379","eureka.instance.status-page-url-path":"/management/info","eureka.instance.health-check-url-path":"/management/health","eureka.instance.instance-id":"${spring.cloud.client.hostname}:${spring.application.name}:${SPRING_CLOUD_APPLICATION_GUID}","eureka.client.service-url.default-zone":"http://localhost:8761/eureka,http://localhost:8762/eureka,http://localhost:8763/eureka","spring.cloud.stream.bindings.input.content-type":"text/plain","spring.cloud.stream.bindings.input.consumer.headerMode":"raw","httpclient.userAgent":"euler-httpclient-processor-kafka","httpclient.headersExpression":"payload.headers","httpclient.timestampExpression":"payload.timestamp","httpclient.serviceCodeExpression":"payload.serviceCode","httpclient.phoneNumberExpression":"payload.simId","httpclient.bodyExpression":"payload.payload","httpclient.replyExpression":"#response.body","httpclient.noTransferExpression":"#transferData.toString()"}}]}
Spencer Gibb
@spencergibb
Mar 02 2018 01:17
will you log an issue?
Haruhiko Nishi
@hanishi
Mar 02 2018 01:19
Is there any other tests that I should perform before logging the issue? so it's more convincing.
Haruhiko Nishi
@hanishi
Mar 02 2018 01:37
Is this OK? spring-cloud/spring-cloud-netflix#2750
Spencer Gibb
@spencergibb
Mar 02 2018 01:46
yes
Marcos Barbero
@marcosbarbero
Mar 02 2018 09:35

I'm trying to play with spring-cloud-gateway but I'm facing some issues, I just created a project using the start.spring.io, also compared to this configuration in the spring-cloud page as well as to the spring-cloud-gateway-sample but I couldn't find what's the missing piece here. Whenever I start the application I get the following error:

ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
2018-03-02 10:29:09.446 ERROR 36662 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:76) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:61) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at com.marcosbarbero.wd.gateway.Application.main(Application.java:11) [classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.getWebServerFactory(ReactiveWebServerApplicationContext.java:125) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.createWebServer(ReactiveWebServerApplicationContext.java:99) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:73) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    ... 8 common frames omitted

I tried to add the following property but the error is still the same

spring:
  main:
    web-application-type: reactive
@spencergibb maybe you know on the spot what's the missing part
Dave Syer
@dsyer
Mar 02 2018 09:36
Can you paste your dependencies?
Marcos Barbero
@marcosbarbero
Mar 02 2018 09:36
just a sec
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

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

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
I also tried to add
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
no diff in the error
Dave Syer
@dsyer
Mar 02 2018 09:40
For sure you need webflux
That should have fixed it.
Marcos Barbero
@marcosbarbero
Mar 02 2018 09:41
I thought so
Dave Syer
@dsyer
Mar 02 2018 09:41
Probably that one is included in the gateway starter though
So it might be redundant
I have my doubts about that
What do you get from mvn dependency:tree?
Marcos Barbero
@marcosbarbero
Mar 02 2018 09:42
you're right, it's in the gateway starter
here it is
actually I can't add here the entire dependency tree
just a sec
Dave Syer
@dsyer
Mar 02 2018 09:47
Looks good to me. How did you run the app?
Bad jar file?
Marcos Barbero
@marcosbarbero
Mar 02 2018 09:47
in this version I've spring-boot-starter-webflux explicitly added to the pom.xml
I tried in couple ways actually
  1. mvn spring-boot:run
  2. IDE Run button
  3. java -jar ...
maybe I'm missing something in the java config level, not sure
I only have my generated startup class
@SpringBootConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
Dave Syer
@dsyer
Mar 02 2018 09:59
Works for me
I think you have a bad jar
Happens sometimes when you do a big download (new Spring Boot version for instance)
Marcos Barbero
@marcosbarbero
Mar 02 2018 10:02
I'll try to purge my local repository, let's see
Marcos Barbero
@marcosbarbero
Mar 02 2018 10:11
that's really weird, if I do run a test class annotated with @SpringBootTest it loads the context correctly
not the same case when I run the main class
Dave Syer
@dsyer
Mar 02 2018 10:17
I think you I think you made a mistake
You meant to write @SpringBootApplication
start.spring.io would have done that for you
(That class you pasted above is not generated from start.spring.io)
Marcos Barbero
@marcosbarbero
Mar 02 2018 10:19
oh yeah, I tried to play with that annotation a bit and for sure I've added the wrong one later on
well, that was it.. shame on me
CaiJiahe
@SystemOutPrint
Mar 02 2018 10:49
spring-projects/spring-restdocs#487
help me
Dave Syer
@dsyer
Mar 02 2018 11:27
You can't use Finchley M7 with Boot 2.0.0.RELEASE
Check start.spring.io for compatible versions. Or look at the cloud bom.
But anyway @wilkinsona already pointed out a possible mistake. Did you try using @SpringBootTest?
Kent Johnson
@kentoj
Mar 02 2018 19:52
@dsyer I am using Finchley M7 with Boot 2.0.0.R2 What is different in release that is incompatible?
Also, @spencergibb I am still getting a 200 returned when SCG fails to find a service in the load balancer. I am on Finchley.M7 Spring Boot 2.0.0.R2
Spencer Gibb
@spencergibb
Mar 02 2018 19:55
latest is boot 2.0.0.RELEASE and Finchley.M8 as of a few minutes ago.
Kent Johnson
@kentoj
Mar 02 2018 19:55
SWEET! I'm upgrading now
@spencergibb A friend told me I might have to write my own WebSockets code if I want to use Socket.io with Netty. Currently the SpringFramework supports the Stomp protocol with SockJS. Are there plans to include support for Socket.io with SCG?
Kent Johnson
@kentoj
Mar 02 2018 20:01
Sorry, I spoke too soon. I am not looking for Socket.io support in SCG
I would have to use Netty with my endpoint service since that is what would be the websocket server. I am excited for Netty support in Spring Boot 2.0.0.RELEASE so I can start playing around with Socket.io and netty.
As long as SCG proxies any WebSocket connection I am good.
Marc Paquette
@marcpa00
Mar 02 2018 22:12

Hi, previously on spring-boot-2.0.0.M6/spring-cloud-Finchley.M4 this worked but now on spring-boot-2.0.0.RELEASE/spring-cloud-Finchley.M7, I have a hard time getting sleuth traces exported to zipkin.
I have the following in my application.yml:

spring:
  sleuth:
    sampler:
      probability: 1.0
      percentage: 1.0
    enabled: true
  zipkin:
    baseUrl: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411}

(i.e. tried both old property "percentage" and new property "probability" to no avail),
but my traces always comes out as "spanExportable:false". Here is an extract of a log entry (by JsonLayout with log4j2):
"contextMap":{"X-B3-SpanId":"58dc07b0be8cab50","X-B3-TraceId":"58dc07b0be8cab50","X-Span-Export":"false","spanExportable":"false","spanId":"58dc07b0be8cab50","traceId":"58dc07b0be8cab50"}

Any idea ?

(I would use Finchley.M8, but minutes ago there were artifacts still unavailable so could not build my application)
Here is the error with Finchley.M8 :
[ERROR] Failed to execute goal on project dcc-edge: Could not resolve dependencies for project gov.dcc.adapter:dcc-edge:jar:0.1.0-SNAPSHOT: Failed to collect dependencies at org.springframework.cloud:spring-cloud-starter-sleuth:jar:2.0.0.M8: Failed to read artifact descriptor for org.springframework.cloud:spring-cloud-starter-sleuth:jar:2.0.0.M8: Failure to find io.zipkin.brave:brave-bom:pom:4.16.3-SNAPSHOT in https://repo.spring.io/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring-snapshots has elapsed or updates are forced -> [Help 1]