Troubleshooting deployment errors in Sharepoint can sometimes be frustrating. Often you get some cryptic error and a inspiring message to “Please try again” when trying again really isn’t going to make much of a difference.
Just now I was trying to deploy a site definition after making a minor change to it. I hadn’t touched this particular definition in a while, and honestly, I felt a little rusty. I thought I had done the right thing, but when I deployed the solution using STSADM.exe, Sharepoint didn’t like my changes.
Now the problem I had is pretty specific but reading through this article you might be able to use some of these troubleshooting steps to find the cause of a similar, or maybe even a not so similar, problem.
When using STSADM.exe to deploy it gave me this error message:
faarebrot"
Provisioning did not succeed. Details: The site template was not provisioned suc
cessfully. Delete this site collection in Central Administration, and then creat
e a new site collection. OriginalException: Provisioning did not succeed. Detail
s: Failed to completely create the subsite ‘http://localhost:15000/DevelopingPeo
ple’. OriginalException: Cannot complete this action.
Please try again.
Not very helpful at all. Of course, the event viewer isn’t much help either:
not succeed. Details: The site template was not provisioned successfully. Delete this
site collection in Central Administration, and then create a new site collection.
OriginalException: Provisioning did not succeed. Details: Failed to completely create
the subsite ‘http://localhost:15000/DevelopingPeople’. OriginalException: Cannot
complete this action.
Please try again..
Swell. So let’s go digging through the log files instead. If you don’t have your logfiles set to capture medium and high level events, now is the time to do so. Now the log files include a whole bunch of information for each line, like timestamp, process, TID, Area, Category, and so forth. But for the sake of information overload, I’ve only included the actual message here (although all the messages came from the STSADM.EXE process).
Preparing 1 features for activation
Feature Activation: Batch Activating Features at URL http://localhost:15000/DevelopingPeople ‘PublishingWeb’ (ID: […]), .
Feature Activation: Batch Activated Features at URL http://localhost:15000/DevelopingPeople ‘PublishingWeb’ (ID: […]), .
Feature Activation: Activating Feature ‘Client.Feature.Generic’ (ID: […]) at URL http://localhost:15000/DevelopingPeople.
SPContentTypeBindingElement.ElementActivated(). Applying ContentType […] to list ‘Pages’ on web […]
Creating directory Pages/Forms/Client Intranet Publishing Page
SPContentTypeBindingElement.ElementActivated(). Successfully applied ContentType […] to list ‘Pages’ on web […]
Feature Activation: Feature ‘Client.Feature.Generic’ (ID: […]) was activated at URL […]
Creating default lists
Creating directory Lists
Creating default modules at URL "http://localhost:15000/DevelopingPeople"
Failed to apply template "Client.SiteTemplate#0" to web at URL "http://localhost:15000/DevelopingPeople".
Failed to apply template "Client.SiteTemplate#0" to web at URL "http://localhost:15000/DevelopingPeople", error 0x80004005
Cannot complete this action. Please try again.
I’ve trimmed some of the lines here (denoted by […]) because they were too wide, but you should get the gist of it. The clue here is to find out what it was doing when it failed.
At first glance you might think “Well, geez, it still says please try again… That’s not very helpful at all!”. But like I said, the clue is to see what it was doing before it failed. Now the second last line says ‘error 0x80004005’. Your first thought might be to try and google this, but it won’t do you much good. I don’t know what this error code actually is for, but my gut feeling says it’s some sort of generic error code. What we can learn from this line however, is what Sharepoint was trying to do when it failed.
‘Failed to apply template…’
Interesting. Basically, it’s trying to apply a configuration template from the Onet.xml file but it errors out. Now the name itself tells you exactly which Onet.xml file to look in. In this case, it’s the Client.SiteTemplate#0. The part before the # tells you what file it is, and the part after the # tells you exactly which configuration inside of the onet.xml file it is (you can have multiple configurations in each onet.xml file). The file itself should be located at 12\TEMPLATE\SiteTemplates\Client.SiteTemplate\XML\Onet.xml.
So we know that it was trying to apply configuration #0 of this particular site definition. We’re not quite sure what failed though. So let’s take a look at the log files again. If we look at the line before the ‘Failed to apply template…” we see that the last thing it was doing while applying the template, was creating the default module. Ok, so let’s have a look at the module configuration in the onet.xml file.
Now the Onet.xml is big, so I’m going to trim away some of the lines here (again, denoted by […]) and just show the stuff that pertains to the error I had.
<!– _lcid="1033" _version="12.0.2220" _dal="1" –>
<!– _LocalBinding –>
<Project Revision="1" Title="CareerDevelopment" ListDir="Lists" xmlns:ows="Microsoft SharePoint">
[…]
<Configurations>
<Configuration ID="-1" Name="NewWeb"/>
<Configuration ID="0" Name="CareerDevelopmentHome" MasterUrl="~SiteCollection/_catalogs/masterpage/ClientIntranetBaseMaster.master">
[…]
<Modules>
<Module Name="$Resources:Client.Resources.SiteTemplates,module_Career_Name;" />
</Modules>
</Configuration>
</Configurations>
<Modules>
<File Url="default.aspx" NavBarHome="True" Type="GhostableInLibrary">
<Property Name="Title" Value="$Resources:Client.Resources.SiteTemplates,module_Career_Name;" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/ClientIntranetLanding.aspx, ~SiteCollection/_catalogs/masterpage/ClientIntranetLanding.aspx" />
<Property Name="ContentType" Value="Client Intranet Publishing Page" />
</File>
</Modules>
</Project>
At first glance, I see nothing wrong. You might be smarter than me though. Have a look at how the module is defined. There’s a <Modules> tag, saying there’s going to be one or more modules defined inside of it. Then it goes directly to a <File> tag. In the words of Adam Savage “Well, here’s your problem!”. It should in fact go like this:
<Module Name="$Resources:Client.Resources.SiteTemplates,module_Career_Name;"
Url="$Resources:cmscore,List_Pages_UrlName;" Path="">
<File Url="default.aspx" NavBarHome="True" Type="GhostableInLibrary">
<Property Name="Title" Value="$Resources:Client.Resources.SiteTemplates,module_Career_Name;" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/ClientIntranetLanding.aspx, ~SiteCollection/_catalogs/masterpage/ClientIntranetLanding.aspx" />
<Property Name="ContentType" Value="Client Intranet Publishing Page" />
</File>
</Module>
</Modules>
Notice how the <File> tag goes inside a <Module> tag. Sharepoint is expecting <Modules> to have one or more <Module> tags inside of it, so going directly to a <File> tag makes it fail. After fixing that, the solution deployed no problem.
Like I said, this is a pretty specific error, but you can use some of the steps to troubleshoot your “Please try again” errors. I’ve seen this kind of behaviour for other Onet.xml file related errors as well, like when I’ve used different spellings of the module name inside and outside of the Configuration tag, when misspelling property names or values on features, and a bunch of other things.
The bottom line is: open the log files, find the error, see what Sharepoint was trying to do before it failed.
Leave a Reply