Details
-
Bug
-
Resolution: User Error
-
Major
-
None
-
3.2.1
-
None
-
CB Server 6.6.2 Build 9588
-
1
Description
Getting a NullPointerException when Java app attempts connection to CB cluster with 1 kv node, 1 index node, and 2 query nodes.
For reference, see attached full error stacktrace and related Slack thread on #sdks-and-connectors channel
The 2 query nodes were each configured with an alternate address with the following commands:
curl -v -X PUT -u admin:password \
|
http://query1:8091/node/controller/setupAlternateAddresses/external \
|
-d hostname=NginxHostname
|
curl -v -X PUT -u admin:password \
|
http://query2:8091/node/controller/setupAlternateAddresses/external \
|
-d hostname=NginxHostname
|
The test app:
public class testApp { |
public static void main(String[] args) { |
ClusterEnvironment environment = ClusterEnvironment
|
.builder()
|
.ioConfig(IoConfig.networkResolution(NetworkResolution.EXTERNAL)
|
.enableDnsSrv(false)) |
.build();
|
Cluster cluster = Cluster
|
.connect("localhost", |
ClusterOptions.clusterOptions("Administrator", "password") |
.environment(environment));
|
QueryResult result = cluster.query("SELECT * FROM `travel-sample` WHERE type='hotel' LIMIT 1"); |
}
|
}
|
Per Michael Reiche,
1. The exception occurs at com.couchbase.client.core.Core.lambda$reconfigureGlobal$39(Core.java:709)
2. The fix should be
Change this line in Core.java
if (alternateAddress.isPresent()) {
to
if (alternateAddress.isPresent() && ni.alternateAddresses().containsKey(alternateAddress.get())) {
Attachments
Issue Links
- links to