Freigeben über


NullReferenceException when Attempting to Configure Managed Accounts

 

While attempting to visit Configure managed accounts (ManagedAccounts.aspx) in a SP2013 farm today, I got a correlation ID and the tip of the NRE iceberg: "Object reference not set to an instance of an object."

 

 

Here's what the salient part of the ULS logs looked like. . .

 

10/14/2014 15:47:12.42  w3wp.exe (0x0D68)        0x12E0  SharePoint Foundation General                8nca       Medium                Application error when access /_admin/ManagedAccounts.aspx, Error=Object reference not set to an instance of an object.   at Microsoft.SharePoint.ApplicationPages.ManagedAccountsDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.DataTableDataSourceView.Select(DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)     at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)     at System.Web.UI.WebControls.DataBoundControl.PerformSelect()     at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()     at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 0026c29c-cff6-10ad-8bc3-c9b12404a3bd

 

10/14/2014 15:47:12.42  w3wp.exe (0x0D68)        0x12E0  SharePoint Foundation Runtime               tkau       Unexpected                System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.SharePoint.ApplicationPages.ManagedAccountsDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.DataTableDataSourceView.Select(DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)     at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)     at System.Web.UI.WebControls.DataBoundControl.PerformSelect()     at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()     at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 0026c29c-cff6-10ad-8bc3-c9b12404a3bd

 

10/14/2014 15:47:12.42  w3wp.exe (0x0D68)        0x12E0  SharePoint Foundation General                ajlz0       High       Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.ApplicationPages.ManagedAccountsDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.DataTableDataSourceView.Select(DataSourceSelectArguments selectArguments)     at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)     at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)     at System.Web.UI.WebControls.DataBoundControl.PerformSelect()     at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()     at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)   0026c29c-cff6-10ad-8bc3-c9b12404a3bd

 

 

Resolution

 

First you have to identify all the Managed Accounts that have automatic password reset enabled. If you're seeing this NRE you used to be able to check this through Central Admin, but now you can't. So run this cmdlet instead:

Get-SPManagedAccount | ? {$_.AutomaticChange -eq $true} | SELECT UserName

Here's what that looks like in a simple lab environment that is not experiencing the NRE:

 

 

This command displays the list of managed accounts in your farm that are set to have their passwords set to change automatically. Make a note of all the different accounts that are returned. You'll need one or more of them soon.

 

Second, look at all the Password Generation timer jobs associated with various accounts and servers. The Password Generation timer job is the job that "generates new password for an account, updates the account password, then launches jobs to deploy the new password to everything that uses it."

To do this, open Central Admin and select Monitoring, as seen below.

Then select Check job status. . .

Select Scheduled from the Timer.aspx page. . .

Look for "Password Generation" jobs for various accounts and various servers.

In my screenshot above I only find two jobs total. This is because I happen to only have one managed account that is set to have its password automatically changed by SharePoint and I happen to only have two SharePoint servers in this farm. You might have many more.

This could be a little tricky. What is not there that should be there? Compare the list of Password Generation jobs with the list of Managed Accounts that are set to have password changes. Look for one or more jobs that should be there but aren't there. A missing job is probably the null reference SharePoint is complaining about. If the job is there, leave it alone. Don't delete it. If the job should be there, and it isn't there, make note of the account that it's not there for. The root cause of this problem is that Central Admin is looking for a timer job that is not there.

Third, for any managed account that showed up in the list produced by "Get-SPManagedAccount | ? {$_.AutomaticChange -eq $true} | SELECT UserName" AND which does NOT have a Password Generation job, execute the script below to force the account to no longer have the AutomaticChange of passwords set to true.

 

$acct = Get-SPManagedAccount "<DOMAIN>\<UserName>" ß(Change that to the actual domain and username of the account in focus.)

$acct.AutomaticChange = $false

$acct.Update()

 

Or if you prefer, you can just do it for all the managed accounts.

Now you should be able to visit Configure managed accounts (ManagedAccounts.aspx) and set the account(s) to have an automatic password change schedule again.

Comments

  • Anonymous
    October 21, 2014
    I saw this NRE again today and could not find any missing timer jobs. So one part of this blog (about root cause) is not correct in all cases.  
  • Anonymous
    November 06, 2014
    IISReset on Application servers was required, after setting AutomaticChange to false for accounts without a Password Generation job.