I am trying to create a sitecollection while autmatically applying a site template. The issue that I am having is that on one server, everything works fine, on another server I get the eror, "Object Instance not set to an instance of an object". I get the error on the line that says, "using (SPSite site = webApp.Sites.Add(.....)
SPWebApplication webApp = SPWebApplication.Lookup(new Uri(siterootname));
SPWebApplication.Lookup(new Uri(siterootname));
using (SPSite site = webApp.Sites.Add(sitefinalurl, sitetitle, sitedesc, 1033, null, spOwnerLogin, spOwnerName, spOwnerEmail, spSecondaryOwner, spSecondaryContactName, spSecondaryEmail, dbserver, dbname, spOwnerName, spOwnerPassword))