Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-1883

NullPointerException when using Alternate Address

    XMLWordPrintable

Details

    • Bug
    • Resolution: User Error
    • Major
    • None
    • 3.2.1
    • Core
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              david.nault David Nault
              enrico.pagayucan Enrico Pagayucan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty