OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.43k stars 1.92k forks source link

feign-ribbon dependency of ribbon is 2.1.1, but this some error. #657

Closed yangguang001 closed 6 years ago

yangguang001 commented 6 years ago
Caused by: java.lang.IllegalAccessError: tried to access method com.netflix.config.DynamicIntProperty.<init>(Ljava/lang/String;I)V from class com.netflix.loadbalancer.DynamicServerListLoadBalancer
    at com.netflix.loadbalancer.DynamicServerListLoadBalancer.<clinit>(DynamicServerListLoadBalancer.java:86)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.netflix.client.ClientFactory.instantiateInstanceWithClientConfig(ClientFactory.java:202)
    at com.netflix.client.ClientFactory.registerNamedLoadBalancerFromclientConfig(ClientFactory.java:166)
    at com.netflix.client.ClientFactory.registerNamedLoadBalancerFromProperties(ClientFactory.java:187)

but in springcloud version, this was use ribbin 2.2.0, it was ok

yangguang001 commented 6 years ago

MyService api = Feign.builder().client(RibbonClient.create()).target(MyService.class, "https://myAppProd");

yangguang001 commented 6 years ago
public DynamicIntProperty(String propName, int defaultValue) {
        super(propName, Integer.valueOf(defaultValue));
    }

should be

public DynamicIntProperty(String propName, int defaultValue) {
        public super(propName, Integer.valueOf(defaultValue));
    }
kdavisk6 commented 6 years ago

This appears to be a dependency resolution problem in your project. If you do not want to use the version of Ribbon referenced by Feign, exclude it or override it.