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

3rd
Mar 2017
Hullaert Christof
@cHullaert
Mar 03 2017 01:16
hello
I've problem I can't explain since 2 days. "org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hystrixStreamEndpoint' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration$HystrixWebConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException"
it's very curious since I've commons-lang in my gradle dependencies
LIN
@magixsource
Mar 03 2017 05:58
hello guys
Ziemowit
@Ziemowit
Mar 03 2017 09:12

Hi guys!

I have problem with one of my services in spring zuul. Services are searched via Eureka.
And for one of them the InstanceInfo contains following properties:

instanceId = "172.20.39.197:foo-service:8763"
appName = "FOO-SERVICE"
appGroupName = null
ipAddr = "172.20.39.197"
sid = "na"
port = 8080
securePort = 443
homePageUrl = "http://172.20.39.197:8080/"
statusPageUrl = "http://172.20.39.197:8080/info"
healthCheckUrl = "http://172.20.39.197:8080/health"

The weird thing is that foo-service works on port 8763... But here port is 8080 (so the port of zull proxy server).
For others services I have correct ports (port property is same as in "172.20.39.197:foo-service:8763" string) and connection can be done.
For this single foo service cannot be.

Any idea why it may happen?

LIN
@magixsource
Mar 03 2017 09:13
do you use spring-cloud-config ?
Ziemowit
@Ziemowit
Mar 03 2017 09:14
No. Not yet at least.
Even when I check logs of eureka I see:
FOO-SERVICE/172.20.39.197:foo-service:8763
So all seems to be fine there.
I can even reach my foo-service when I put to request port 8763. The problem starts when zuul tries to get the port based on service id from eureka.
LIN
@magixsource
Mar 03 2017 09:18
check whether port 8080 has used by other application
OR try to change instanceId to 172.20.39.197:foo-service:8080
Ziemowit
@Ziemowit
Mar 03 2017 09:20
yes port 8080 is used by spring-zull itself ;]
LIN
@magixsource
Mar 03 2017 09:20
i config service by yml file
server:
  port: 8080
Ziemowit
@Ziemowit
Mar 03 2017 09:21

My foo service has already in bootstrap.yml

server:
port: 8763

LIN
@magixsource
Mar 03 2017 09:23
is application.yml exist ?
Ziemowit
@Ziemowit
Mar 03 2017 09:23
yes
also
LIN
@magixsource
Mar 03 2017 09:25
application.yml can override bootstrap.yml
Ziemowit
@Ziemowit
Mar 03 2017 09:25
I can try and add there also the port 2nd time. Always worth to try.
LIN
@magixsource
Mar 03 2017 09:25
let me see bootstarp.yml and application.yml if could
Ziemowit
@Ziemowit
Mar 03 2017 09:26
one moment
bootstrap.yml
eureka:
  client:
    eureka-server-port: 8761
server:
  port: 8763
  context-path: /foo-service/rest
spring:
  application:
    name: foo-service
LIN
@magixsource
Mar 03 2017 09:29
correct config
Ziemowit
@Ziemowit
Mar 03 2017 09:30
The application.yml
endpoints:
  shutdown:
    enabled: true
logging:
  level:
    ... // logging staff
management:
  context-path: /admin/system/state
  security:
    roles: ROLE_TENANT_ADMIN
  info:
    git:
      mode: full
server:
  session:
    timeout: 7200
  tomcat:
    accesslog:
      enabled: true
      prefix: foo_service_logs.
      directory: ../logs
    basedir: tomcat
spring:
  http:
    converters:
      preferred-json-mapper: gson
  jpa.open-in-view: false
  thymeleaf:
    cache: false
    mode: HTML
  velocity:
    enabled: false
LIN
@magixsource
Mar 03 2017 09:31
spring:
  application:
    name: gateway-server

# routes to serviceId
zuul:
  routes:
    police:
      path: /police/**
      stripPrefix: true
      url: http://localhost:9000/app/


eureka:
  client.serviceUrl.defaultZone: http://localhost:8761/eureka/

server:
  port: 9001
this is my gateway config
Ziemowit
@Ziemowit
Mar 03 2017 09:32
yeag but I want to use service-id not hardcoded urls ;]
LIN
@magixsource
Mar 03 2017 09:32
try to add server: port: 9001
to application.yml
Ziemowit
@Ziemowit
Mar 03 2017 09:32
Okey I will try. Thank you.
LIN
@magixsource
Mar 03 2017 09:32
server: port: 8763
and spring.application.name:foo-service
Ziemowit
@Ziemowit
Mar 03 2017 09:40

Ok I have changed the port of zuul to 9000 and updated the application.yml of foo-service.
And still 8080 displays on zuul site in InstanceInfo for foo-service. Then seems it will be some setting in foo-service.
Configuration is very complex (big application). Then need to go and check one by one.

Thank you for you support!

LIN
@magixsource
Mar 03 2017 09:41
you are welcome brother
Ziemowit
@Ziemowit
Mar 03 2017 10:10

Ok the problem is earlier. When my foo-service registers itself to eureka already the port is wrong:

public void InstanceRegistry::register(final InstanceInfo info, final boolean isReplication)

instanceId = "172.20.39.197:foo-service:8763"
appName = "FOO-SERVICE"
appGroupName = null
ipAddr = "172.20.39.197"
sid = "na"
port = 8080
What is weird in instanceId is correct. But port property is wrong - as should be like in instanceId => 8763
Ziemowit
@Ziemowit
Mar 03 2017 10:38
Ok I have found that EurekaClientAutoConfiguration does not see my settings in bootstrap.yml and uses defaults.
I think the problem is in multi-module project (old application which I am rewriting).
LIN
@magixsource
Mar 03 2017 10:41
is that yml files in classpath:/ classpath:config ?
Ziemowit
@Ziemowit
Mar 03 2017 10:44
Should be. But ok now I see what is the problem. Will solve it.