Netflix/ribbon

URLConnectionLoadBalancer example missing some details and fails to load

Closed this issue · 1 comments

The exampleample URLConnectionLoadBalancer returns the following error stacktrace.

Any ideas on how to implement a mininal working example for the missing configuration loader?
(I'm using ribbon-loadbalancer independently)

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.netflix.loadbalancer.LoadBalancerBuilder.<init>(LoadBalancerBuilder.java:14)
	at com.netflix.loadbalancer.LoadBalancerBuilder.newBuilder(LoadBalancerBuilder.java:26)
	at com.netflix.loadbalancer.LoadBalancerBuilder$newBuilder.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
	at com.fiserv.cbs.faxservice.URLConnectionLoadBalancer.<init>(URLConnectionLoadBalancer.groovy:25)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:249)
	at com.fiserv.cbs.faxservice.URLConnectionLoadBalancer.main(URLConnectionLoadBalancer.groovy:56)
Caused by: java.lang.IllegalStateException: Expecting at least one implementation of ClientConfigFactory discoverable via the ServiceLoader
	at com.netflix.client.config.ClientConfigFactory.lambda$findDefaultConfigFactory$1(ClientConfigFactory.java:41)
	at java.util.Optional.orElseGet(Optional.java:267)
	at com.netflix.client.config.ClientConfigFactory.findDefaultConfigFactory(ClientConfigFactory.java:40)
	at com.netflix.client.config.ClientConfigFactory.<clinit>(ClientConfigFactory.java:29)

FIXED: Turns out I was missing a ribbon dependency, after adding ribbon-transport to my build.gradle the example works!