cfg4j / cfg4j

Modern configuration library for distributed apps written in Java.

Home Page:http://cfg4j.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConsulConfigrationSource failing to connect to Consul

bjtieman opened this issue · comments

I'm trying to create a ConsulConfiguration source with code like

`ConfigurationSource source = new ConsulConfigurationSourceBuilder()
.withHost("ipdevenvdev01.ip.devcerner.net")
.withPort(8500)
.build();

        Environment environment = new ImmutableEnvironment("Dev");

        configurationProvider = new ConfigurationProviderBuilder()
            .withConfigurationSource(source)
            .withEnvironment(environment)
            .build();`

but when I run my application I get the error

Exception in thread "main" org.cfg4j.source.SourceCommunicationException: Unable to communicate with configuration source: Can't connect to host ipdevenvdev01.ip.devcerner.net:8500 at org.cfg4j.source.consul.ConsulConfigurationSource.init(ConsulConfigurationSource.java:105) at org.cfg4j.provider.ConfigurationProviderBuilder.build(ConfigurationProviderBuilder.java:142) at com.cerner.chronicle.configuration.Configuration.getConfigurationProvider(Configuration.java:43) at com.cerner.chronicle.cli.ChronicleLauncher.main(ChronicleLauncher.java:11) Caused by: com.orbitz.consul.ConsulException: Error connecting to Consul at com.orbitz.consul.AgentClient.ping(AgentClient.java:74) at com.orbitz.consul.Consul.<init>(Consul.java:73) at com.orbitz.consul.Consul.<init>(Consul.java:24) at com.orbitz.consul.Consul$Builder.build(Consul.java:337) at org.cfg4j.source.consul.ConsulConfigurationSource.init(ConsulConfigurationSource.java:101) ... 3 more Caused by: java.lang.NullPointerException at org.apache.cxf.jaxrs.client.AbstractClient.setupOutInterceptorChain(AbstractClient.java:890) at org.apache.cxf.jaxrs.client.AbstractClient.createMessage(AbstractClient.java:961) at org.apache.cxf.jaxrs.client.WebClient.finalizeMessage(WebClient.java:1122) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1095) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:894) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:865) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:428) at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1620) at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1615) at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.get(WebClient.java:1535) at org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.get(InvocationBuilderImpl.java:80) at com.orbitz.consul.AgentClient.ping(AgentClient.java:66) ... 7 more

Digging into the code for cfg4j it looks like a number of dependencies are out of date. Consul client is up to 1.3.0 while while the latest release of cfg4j (4.4.1) looks to still be using 0.10.1. I have Consul 1.4.1 deployed. I'm pretty certain my connection woes are version related somehow.

It looks like there were a number of pulls to master in Sept 2018 in preparation for a 5.0 release and the master branch is up to Consul client 1.2.4 but nothing new has happened in master since September. There are also a number of pull requests that do not have any comments from the authors.

Is cfg4j still an active project? I'd very much like to use it as our configuration management system for a new software platform we're building but, as it stands right now, I can't get it to integrate with Consul properly and am a little worried that the project is no longer being kept up :(