Synchronize fails with - System.NullReferenceException

Nov 14, 2012 at 10:07 PM

Config file is validated. Activation is fine with no errors. Manual Sync gives the error:

System.NullReferenceException: Object reference not set to an instance of an object. at Slam.StructureMap.XmlTypeProfileSection.GetTypeProfileName(String siteCollection, String site, String id, String typeName) at Slam.StructureMap.ComponentFactory.GetInstance[T](String siteCollection, String site, String typeName) at Slam.ComponentService.GetInstance[T](String siteCollection, String site, String typeName) at Slam.SharePoint.SPListItemExtender.SlamUpdate(SPListItem listItem, Boolean runWithElevatedPriveleges, Boolean saveItem, Boolean saveAsSystem, String updateUserName, Boolean isNew, Boolean updateFolderChildren) at Slam.SharePoint.SPListItemExtender.SlamUpdate(SPListItem listItem, Boolean runWithElevatedPriveleges, Boolean saveItem, Boolean saveAsSystem) at Slam.Activation.SqlDataSynchronizeTypeProcessor.SynchronizeListItem(SPListItem listItem) at Slam.Activation.SqlDataSynchronizeTypeProcessor.<>c__DisplayClass4.<Process>b__0()

 

Config file looks like:

<?xml version="1.0" encoding="utf-8" ?>

<Configuration>
	<ConnectionStrings Default="SLAM">
		<add Name="SLAM" ConnectionString="Database=SLAMDB;Data Source=hp-demodb;User Id=user;Password=password" />
	</ConnectionStrings>

	<DataMapping DataSchema="SLAM">
		<List Site="/sites/demo/Sales/resources/requests" Name="Activity Types" ActivationOrder="1">
			<Fields>
				<Field Name="Title" SqlType="varchar(255)" SPType="Text" Required="true"></Field>
				<Field Name="MMDescription" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
				<Field Name="MMSortOrder" SqlType="int" SPType="Number" Required="false"></Field>
			</Fields>
		</List>
	</DataMapping>
</Configuration>

Any suggestion for it?  Is the use of Site correct?

Thanks.

Dec 10, 2012 at 2:45 PM

  I am experiencing the same error. Any ideas or fix for this yet?

Dec 10, 2012 at 2:59 PM
12/10/2012 10:58:49 AM Information Data Synchronization Complete
12/10/2012 10:58:49 AM Information Data Synchronization Cleanup: SLAM
12/10/2012 10:58:49 AM Information Data Synchronization Processing: SLAM
12/10/2012 10:58:49 AM Exception System.NullReferenceException: Object reference not set to an instance of an object. at Slam.StructureMap.XmlTypeProfileSection.GetTypeProfileName(String siteCollection, String site, String id, String typeName) at Slam.StructureMap.ComponentFactory.GetInstance[T](String siteCollection, String site, String typeName) at Slam.ComponentService.GetInstance[T](String siteCollection, String site, String typeName) at Slam.SharePoint.SPListItemExtender.SlamUpdate(SPListItem listItem, Boolean runWithElevatedPriveleges, Boolean saveItem, Boolean saveAsSystem, String updateUserName, Boolean isNew, Boolean updateFolderChildren) at Slam.SharePoint.SPListItemExtender.SlamUpdate(SPListItem listItem, Boolean runWithElevatedPriveleges, Boolean saveItem, Boolean saveAsSystem) at Slam.Activation.SqlDataSynchronizeTypeProcessor.SynchronizeListItem(SPListItem listItem) at Slam.Activation.SqlDataSynchronizeTypeProcessor.<>c__DisplayClass4.<Process>b__0()
12/10/2012 10:58:49 AM Information Data Synchronization initiated
Dec 10, 2012 at 4:09 PM
Edited Dec 10, 2012 at 4:24 PM

I added a SiteCollection attribute to the DataMapping node and it seems if I am getting further along, however I am getting a new error now about the ListId being Null? Please help.

 

I get this when I try to save a new item to the list.

System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'ListItemID', table 'SLAMTest.SLAM.SLAM'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters) at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters) at Slam.Data.DataContextExtender.ExecuteCommand(DataContext context, Boolean commit, String command) at Slam.Data.SqlDataRepository.InsertItem(String tableSchema, String tableName, Hashtable values) at Slam.Data.SqlDataServices.Insert(String typeName, Hashtable values) at Slam.Events.DefaultEvents.Create(SPListItem listItem, IDataServices dataServices, IConfigurationManager configuration, ILogger logger, String eventPrefix)

And this when I try to manually run the sync.

System.Data.SqlClient.SqlException: Conversion failed when converting from a character string to uniqueidentifier. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters) at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters) at Slam.Data.DataContextExtender.ExecuteCommand(DataContext context, Boolean commit, String command) at Slam.Data.SqlDataRepository.UpdateItem(String tableSchema, String tableName, String id, Hashtable values) at Slam.Data.SqlDataServices.Update(String typeName, String id, Hashtable values) at Slam.Events.DefaultEvents.Update(SPListItem listItem, IDataServices dataServices, IConfigurationManager configuration, ILogger logger, String eventPrefix)

Developer
Dec 10, 2012 at 5:04 PM

I am not certain at this point what the issue may be, but from muradmeghani's post it seems like it's the site collection/site configuration.  So to take the above example you should have something like 

<DataMapping SiteCollection="sites/demo">
<List Site="Sales/resources/requests" Name="Activity Types">
</List>
</DataMapping> 
Dec 10, 2012 at 5:58 PM

Thanks so much for replying.  If I have the list i want to slam on the root of the site collection (sites/demo), do I still need to put something for the attribute "Site" on the List node?

Here is my current config.  I have the list named Slam.

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
 <ConnectionStrings Default="SLAM">
  <add Name="SLAM" ConnectionString="Database=SLAMTest;Data Source=rjc-sql2;User Id=userid;Password=password" />
 </ConnectionStrings>

 <TypeIdDefinitions>
  <add Name="Global" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="true" />
  <add Name="GlobalWithSharePointIDs" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="false" />
 </TypeIdDefinitions>
 
 <DataMapping  DataSchema="SLAM" TypeIdDefinition="Global" SynchronousUpdates="true" SiteCollection="sites/depotDev">
  <List  Name="SLAM" ActivationOrder="1">
   <Fields>
    <Field Name="Project Name" SqlType="varchar(255)" SPType="Text" Required="true"></Field>
   </Fields>
  </List>

 </DataMapping>
</Configuration>

Developer
Dec 10, 2012 at 6:03 PM

In that case you should not need a Site attribute on the List.

Dec 10, 2012 at 6:24 PM

Ok, this is weird but I just created a new list and started from scratch, and it all seems to be working fine now.

Dec 10, 2012 at 11:15 PM

Thank you all for your help.  I added the SiteCollection to my DataMapping and Site to my List definition and it started working!