When I deploy a content query web part (CQWP) through my site definition I’m getting the following error:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
 Correlation ID:4bf473e6-b9f5-4d85-b6f0-ce29e00fa964

As always I started to debug this by fixing the web part (I just added a Link URL therefore I knew the problem was related to this).

I looked at my Link URL and this was pointing to the correct field. I then removed the link url and the web part worked fine. Then I added my link URL column name in the web part and all was working again. hmmm, this is weird.

Then I recreated the site again … and the problem was back. At least the problem is consistent.

I then exported the failing CQWP, fixed the web part again and exported the web part… both exports are identical. Now things are getting silly…

Next step look at the ULS logs. filtering on the given correlation ID.

01/24/2011 05:10:24.21 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (GET:http://myhost:80/sites/mynewsite/Pages/default.aspx) 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964

01/24/2011 05:10:24.22 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/sites/mynewsite 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.22 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (PostResolveRequestCacheHandler). Execution Time=10.0522 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.23 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 7fz3 Medium Setting [Display] as the FormContext.FormMode for the current page 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.23 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 7fz3 Medium Setting [Display] as the FormContext.FormMode for the current page 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.24 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 7fz3 Medium Setting [Display] as the FormContext.FormMode for the current page 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.24 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 7fz3 Medium Setting [Display] as the FormContext.FormMode for the current page 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.27 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (CachedObjectFactory: Caching ListItem at: /sites/mynewsite/Pages/default.aspx). Execution Time=27.4888 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.27 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 8vy8 Medium CrossListQueryCache::GetSiteData() – Query: <ViewFields><FieldRef Name=”Title” Nullable=”True” Type=”Text”/><FieldRef Name=”FileRef” Nullable=”True” Type=”Lookup”/><FieldRef Name=”ID” Nullable=”True” Type=”Counter”/><FieldRef Name=”Modified” Nullable=”True” Type=”DateTime”/><FieldRef Name=”Author” Nullable=”True” Type=”User”/><FieldRef Name=”Editor” Nullable=”True” Type=”User”/><FieldRef Name=”Created” Nullable=”True” Type=”DateTime”/><FieldRef Name=”FSObjType” Nullable=”True” Type=”Lookup”/><FieldRef Name=”PermMask” Nullable=”True” Type=”Text”/><FieldRef Name=”ProgId” Nullable=”True” Type=”Lookup”/><FieldRef Name=”File_x0020_Size” Nullable=”True” Type=”Lookup”/><FieldRef Name=”File_x0020_Type” Nullable=”True” Type=”Text”/><FieldRef Name=”PublishingRollupImage” Nullable=”True” Type=”Image”/><FieldRef Name=”_Level” Nullable=”True” Type=”Number”/><FieldRef Name=”Comments” Nullable=”True” Type=”Note”/><FieldRef Name=”LinkToSite” Nullable=”True” Type=”URL”/><FieldRef Name=”SiteType” Nullable=”True” Type=”Choice”/><FieldRef Name=”Target_x0020_Audiences” Nullable=”True” Type=”TargetTo”/></ViewFields><Lists ServerTemplate=”10002″><List ID=”c144bb53-0376-4d24-9486-8764e984c5b1″/></Lists><RowLimit>2147483647</RowLimit><Query><Where><Eq><FieldRef Name=”ContentType” Nullable=”True” Type=”Text”/><Value Type=”Text”>A Site</Value></Eq></Where><OrderBy><FieldRef Name=”SiteType” Nullable=”True” Type=”Choice” Ascending=”FALSE”/><FieldRef Name=”Created” Nullable=”True” Type=”DateTime” Ascending=”FALSE”/></OrderBy></Query> Url: /sites/mynewsite. Web Part title: Straight To 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.28 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Web Parts 89a1 High Error while executing web part: System.IndexOutOfRangeException: Index was outside the bounds of the array.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.DataViewMapping()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.29 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (CachedObjectFactory: Caching ListItem at: /sites/mynewsite/Style Library/XSL Style Sheets/ContentQueryMain.xsl). Execution Time=19.2112 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.31 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (CachedObjectFactory: Caching ListItem at: /sites/mynewsite/Style Library/XSL Style Sheets/ItemStyle.xsl). Execution Time=14.9148 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.33 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (CachedObjectFactory: Caching ListItem at: /sites/mynewsite/Style Library/XSL Style Sheets/Header.xsl). Execution Time=17.0588 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.33 w3wp.exe (0x1B80) 0x1AE0 Web Content Management Publishing 8vy8 Medium CrossListQueryCache::GetSiteData() – Query: <ViewFields><FieldRef Name=”Title” Nullable=”True” Type=”Text”/><FieldRef Name=”FileRef” Nullable=”True” Type=”Lookup”/><FieldRef Name=”ID” Nullable=”True” Type=”Counter”/><FieldRef Name=”Modified” Nullable=”True” Type=”DateTime”/><FieldRef Name=”Author” Nullable=”True” Type=”User”/><FieldRef Name=”Editor” Nullable=”True” Type=”User”/><FieldRef Name=”Created” Nullable=”True” Type=”DateTime”/><FieldRef Name=”FSObjType” Nullable=”True” Type=”Lookup”/><FieldRef Name=”PermMask” Nullable=”True” Type=”Text”/><FieldRef Name=”ProgId” Nullable=”True” Type=”Lookup”/><FieldRef Name=”File_x0020_Size” Nullable=”True” Type=”Lookup”/><FieldRef Name=”File_x0020_Type” Nullable=”True” Type=”Text”/><FieldRef Name=”PublishingRollupImage” Nullable=”True” Type=”Image”/><FieldRef Name=”_Level” Nullable=”True” Type=”Number”/><FieldRef Name=”Comments” Nullable=”True” Type=”Note”/><FieldRef Name=”BusinessAreaOrFunction” Nullable=”True” Type=”Lookup”/><FieldRef Name=”Target_x0020_Audiences” Nullable=”True” Type=”TargetTo”/></ViewFields><Lists ServerTemplate=”10002″><List ID=”c144bb53-0376-4d24-9486-8764e984c5b1″/></Lists><RowLimit>75</RowLimit><Query><Where><Eq><FieldRef Name=”ContentType” Nullable=”True” Type=”Text”/><Value Type=”Text”>A Site</Value></Eq></Where><OrderBy><FieldRef Name=”BusinessAreaOrFunction” Nullable=”True” Type=”Lookup” Ascending=”TRUE”/><FieldRef Name=”Created” Nullable=”True” Type=”DateTime” Ascending=”FALSE”/></OrderBy></Query> Url: /sites/mynewsite. Web Part title: Content Query 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.41 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Web Parts 89dd Medium AddWithFile:DfwpXslFilesHashCache=Microsoft.SharePoint.WebPartPages.CloneableHashTable 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.41 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (DataBinding DataFormWebPart (Content Query)). Execution Time=81.6142 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.42 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation General 72nz Medium Videntityinfo::isFreshToken reported failure. 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.48 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (EnsureListItemsData). Execution Time=16.2295 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.54 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (Render WebPart Zone RightColumn). Execution Time=111.86 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
01/24/2011 05:10:24.54 w3wp.exe (0x1B80) 0x1AE0 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http://myhost:80/sites/mynewsite/Pages/default.aspx)). Execution Time=332.3169 4bf473e6-b9f5-4d85-b6f0-ce29e00fa964
Still no real clue

Then I checked the xml for the web part again

<property name="DataMappings" type="string">LinkUrl:{5a5d28cc-3349-47e7-ab14-bcfc40e0e82b},LinkToSite,URL;|Description:|ImageUrl:|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|LinkToSite,URL;|</property>
I understand the first part of the above xml but why are there two references to the LinkToSite URL? Changing to above to the below fixed the issue:
<property name="DataMappings" type="string">LinkUrl:{5a5d28cc-3349-47e7-ab14-bcfc40e0e82b},LinkToSite,URL;|Description:|ImageUrl:|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|</property>

It looks like I made a mistake in my xml here however the logging wasn’t very helpful. Anyway problem resolved. Hopefully this will help someone else.

Advertisements