zalando-stups / put-it-to-rest

https://github.com/zalando/riptide/tree/master/riptide-spring-boot-starter
MIT License
11 stars 6 forks source link

Application fails to start with put-it-to-rest #67

Closed divinedragon closed 7 years ago

divinedragon commented 7 years ago

I am trying to integrated this, but I am getting the exception below

Binding to target org.zalando.putittorest.RestSettings@478d8326 failed:

    Property: rest.clients[myservice].connectionTimeout
    Value: 5 seconds
    Reason: Failed to convert property value of type 'java.lang.String' to required type 'org.zalando.putittorest.TimeSpan' for property 'clients[membership].connectionTimeout'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.zalando.putittorest.TimeSpan]

My configuration seems be ok.

rest:
  oauth:
    access-token-url: https://token.example.com
  defaults:
    plugins:
      - original-stack-trace
      - temporary-exception
  clients:
    myservice:
      baseUrl: https://service.example.com
      connection-timeout: 5 seconds
      socket-timeout: 10 seconds
      max-connections-per-route: 10
      oauth:
        scopes:
          - uid
          - service.read
whiskeysierra commented 7 years ago

I've seen a similar behaviour before. Please try the following in order and see if any of them helps:

  1. Upgrade to the latest version.
  2. Upgrade guava to the latest version.
  3. Put all optional dependencies on the classpath.
  4. Please put a breakpoint at the location where Spring fails and start in debug mode. Because Spring is swallowing the original exception, iirc.

Please report back with as much information​ as you have! I have a strong incentive to get this fixed.

On 16 Jun 2017 14:04, "Deepak Shakya" notifications@github.com wrote:

I am trying to integrated this, but I am getting the exception below

Binding to target org.zalando.putittorest.RestSettings@478d8326 failed:

Property: rest.clients[myservice].connectionTimeout
Value: 5 seconds
Reason: Failed to convert property value of type 'java.lang.String' to required type 'org.zalando.putittorest.TimeSpan' for property 'clients[membership].connectionTimeout'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.zalando.putittorest.TimeSpan]

My configuration seems be ok.

rest: oauth: access-token-url: https://token.example.com defaults: plugins:

  • original-stack-trace
  • temporary-exception clients: myservice: baseUrl: https://service.example.com connection-timeout: 5 seconds socket-timeout: 10 seconds max-connections-per-route: 10 oauth: scopes:
    • uid
    • service.read

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zalando-incubator/put-it-to-rest/issues/67, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPnSZarIn8PDMDM7zDY2-6TpIVHd5kks5sEm80gaJpZM4N8YG3 .

whiskeysierra commented 7 years ago

@divinedragon Any luck with my suggestions?

divinedragon commented 7 years ago

@whiskeysierra Havent' tried that. Will try today and will let you know.

whiskeysierra commented 7 years ago

@divinedragon Any news?

whiskeysierra commented 7 years ago

@divinedragon Ping

whiskeysierra commented 7 years ago

Closing this due to inactivity.

duergner commented 7 years ago

I encountered the same error which was solved by adding an explicit dependency for com.google.guava:guava:22.0.

The full build.gradle file (incl. the various different dependencies and versions:

buildscript {
    ext {
        springBootVersion = '1.5.4.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

version = '1.0.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8

jar {
    archiveName = "${baseName}.${extension}"
}

repositories {
    mavenCentral()
}

ext {
    springCloudVersion = 'Dalston.SR2'

    dropwizardMetricsVersion = '3.2.2'
    tracerSpringBootStarterVersion = '0.11.2'
    problemSpringWebVersion = '0.19.0'
    twintipSpringWebVersion = '1.1.0'
    tokensSpringBootStarterVersion = '0.11.0-beta-3'
    tokensVersion = '0.11.0-beta-2'
    stupsSpringOauth2SupportVersion = '1.0.19'
    zmonActuatorVersion = '0.9.7'
    failsafeActuatorVersion = '0.4.0'
    putItToRestVersion = '0.13.0'
    guavaVersion = '22.0'
    mockitoVersion = '2.8.47'
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-undertow")
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.springframework.boot:spring-boot-starter-security")
        compile("org.springframework.boot:spring-boot-starter-actuator")

    compile("org.springframework.cloud:spring-cloud-starter-oauth2")

    compile("org.springframework.boot:spring-boot-devtools")

    compile("io.dropwizard.metrics:metrics-core:${dropwizardMetricsVersion}")
    compile("io.dropwizard.metrics:metrics-annotation:${dropwizardMetricsVersion}")

    compile("org.zalando:tracer-spring-boot-starter:${tracerSpringBootStarterVersion}")
    compile("org.zalando:problem-spring-web:${problemSpringWebVersion}")
    compile("org.zalando:twintip-spring-web:${twintipSpringWebVersion}")
    compile("org.zalando.stups:stups-spring-oauth2-server:${stupsSpringOauth2SupportVersion}")
    compile("org.zalando.stups:stups-spring-oauth2-client:${stupsSpringOauth2SupportVersion}")
    compile("org.zalando.stups:stups-http-components-oauth2:${stupsSpringOauth2SupportVersion}")
    compile("org.zalando.zmon:zmon-actuator:${zmonActuatorVersion}")
    compile("org.zalando:failsafe-actuator:${failsafeActuatorVersion}")
    compile("org.zalando.stups:tokens:${tokensVersion}")
    compile("org.zalando:put-it-to-rest:${putItToRestVersion}")

    compile("com.google.guava:guava:${guavaVersion}")

    compile("com.fasterxml.jackson.datatype:jackson-datatype-guava")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-pcollections")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-hppc")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-joda")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
    compile("com.fasterxml.jackson.module:jackson-module-parameter-names")

    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("org.mockito:mockito-core:${mockitoVersion}")
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

compileJava {
    options.compilerArgs = ['-parameters']
}
whiskeysierra commented 7 years ago

I'm closing this, since I'm migrating this project to be a module of https://github.com/zalando/riptide