NullReferenceException in GetVBucket


#1

CB Community 2.5.0
CouchbaseNetClient 1.2.7

I’m getting a null reference when trying to fetch from String in GetVBucket. I’ve included the stack trace below as well as examples of the methods being called and web.config.

I’m new to Couchabase and though I’ve ensured the key is there and all configs are correct, I’m not sure how to verify it is connecting. Could it be that it is failing to connect and that’s why the key is null or would it raise another exception before reaching this if that were the case?

web.config:







SystemSettings.Load():

using …
using Couchbase;
using Couchbase.Extensions;

namespace APP.DataObjects.SystemSupport
{
public class SystemSettings : BaseClasses.ModelServicesBase
{
private const string KEY = “SYS-SETTINGS-CORE”;

    public static Models.SystemSettingsModel Load()
    {
        try
        {
            string key = KEY;
            Models.SystemSettingsModel model;

            //create a new blank template or get existing data
            if (!client.KeyExists(key))
                return null;

            model = client.GetJson<Models.SystemSettingsModel>(key);

            return model;
        }
        catch
        {
            //create and return defaults
            Models.SystemSettingsModel model = new Models.SystemSettingsModel()
            {
                PortalTimeout = 20,
                SupervisorURL = "",
                APP2Path = ""
            };

            return model;
        }
    }
}

}

[NullReferenceException: Object reference not set to an instance of an object.] Couchbase.CouchbasePool.Couchbase.ICouchbaseServerPool.GetVBucket(String key) +15 Couchbase.CouchbaseClient.Observe(String key, UInt64 cas, PersistTo persistTo, ReplicateTo replicateTo, ObserveKeyState persistedKeyState, ObserveKeyState replicatedState) +94 APP.DataObjects.SystemSupport.SystemSettings.Load() in D:\Visual Studio 2010\Projects\CoolApplication\APP-3.0\APP.DataObjects\SystemSupport\SystemSettings.cs:40 APP.Web.UI4.Controllers.FoldersController.UserFolder() in D:\Visual Studio 2010\Projects\CoolApplication\APP-3.0\APP.Web.UI4\Controllers\FoldersController.cs:203 lambda_method(Closure , ControllerBase , Object[] ) +78 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +247 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +38 System.Web.Mvc.<>c__DisplayClass15.b__12() +124 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +640 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +691 System.Web.Mvc.Controller.ExecuteCore() +162 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +305 System.Web.Mvc.<>c__DisplayClassb.b__5() +62 System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +20 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

#2

Hi andrew.carpenter -

How often does this happen? What is the cluster state at this time - is it in a failover or rebalance state?

Also, have you considered updating your client version? We are currently on 1.3.6; a lot has changed since 1.2.7 with respect to bug fixes.

-Jeff


#3

Thanks Jeff, it looks like it’s fixed. I would love to say I found some actual error that was causing this aside from user error. However, I must have had the password wrong, as updating the password for the bucket fixed it.