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