Friday, July 24, 2009

STSADM - Object reference not set to an instance of an object

Its been nearly 2 days am struggling to deploy a wsp solution in my farm by not using system account credentials. Am running a small farm locally on my system comprising of DC, SQL, Indexer and WFE. It all started with a issue where I was not able to activate a feature on my site using System Account, as activating feature would trigger a functionality in the code where it will check the user and send out a mail after fetching the details from DC. Now you wont find "System Account" in your DC would ya....

NOTE : If you log on to MOSS as an account that is used anywhere else in MOSS say for example an application pool in IIS being used by MOSS then it instantly associates your logged on account as a System Account or in a case where your have gone to Central Administration > Application Management > Policy for Web Application (i.e. /_admin/policy.aspx) and checked the option
"Account operates as System"
by Editing user under seleted WebApp. "You should therefore create unique accounts for managing he Application pools and web applications and create accounts as MOSS administrators.

This meant I had to use a different account other than system account to achieve my objective. I created a new account (fadmin) in my DC and added it to Domain Admins. When I logged to Central Admin Box (i.e. Indexer) using fadmin credentials and tried to add wsp solution using STSADM it threw following error:
stsadm -o addsolution -filename testWSP.wsp
Object reference not set to an instance of an object.testWSP.wsp:
The Solution installation failed.
Now this just did not stop here,I began googling.... after reading some blogs it seemed that issue is related to access rights. I it drove me nutts when, even after giving Farm Admin rights to fadmin account it threw the same error.
I began comparing System Account (i.e. domain\srohilla) access privileges with fadmin access privledges.

Comes out System Account has access to SharePoint_AdminContent_<GUID> DB in SQL,where as fadmin did not. So went ahead and gave appropriate rights to fadmin. This did the trick. Yippeeee!!!!!!!!! Now am able to add solution files successfully via STSADM and activate features.


Anonymous said...

Here is the exact solution for the same.

Salvage Cars said...

I too have faced the similar issues one such error most often when I'm trying to reference a "buried" control within my codebehind.