Synchronization Failed. NullReferenceException

Jan 28, 2013 at 7:58 PM

Hello, I`ve been having some trouble synchronizing A few Sharepoint Lists to a SQL Instance.

 

Here is the error I`m getting:

Date Type Message 
1/28/2013 6:50:15 PM Information Data Synchronization Complete 
1/28/2013 6:50:15 PM Information Data Synchronization Cleanup: Cimento 
1/28/2013 6:50:15 PM Information Data Synchronization Cleanup: Cor 
1/28/2013 6:50:15 PM Information Data Synchronization Processing: Cor 
1/28/2013 6:50:15 PM 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() 
1/28/2013 6:50:15 PM Information Data Synchronization Processing: Cimento 
1/28/2013 6:50:15 PM 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() 
1/28/2013 6:50:14 PM Information Data Synchronization initiated 

 

And here is my slam.config. Everything seems ok in the Validation and I get no errors there:

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

<Configuration>
 <ConnectionStrings Default="SLAM">
  <add Name="SLAM" ConnectionString="Database=SLAMDB;Data Source=xxxxxxxx\xxxxxxxxx; Integrated Security=SSPI" />
 </ConnectionStrings>
  
 <TypeIdDefinitions>
  <add Name="Global" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Int" 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">
  
  <List  Name="Cimento" TableName="cimento" ActivationOrder="1">
   <Fields>
    <Field Name="Title" SqlType="varchar(255)" Column="cimento" SPType="Text" Required="false"></Field>
	<Field Name="codigo" SqlType="varchar(255)" Column="codigo" SPType="Text" Required="false"></Field>
   </Fields>
  </List>
    
  <List  Name="Cor" TableName="cor" ActivationOrder="2">
   <Fields>
    <Field Name="Title" SqlType="varchar(255)" Column="cor" SPType="Text" Required="false"></Field>
	<Field Name="codigo" SqlType="varchar(255)" Column="codigo" SPType="Text" Required="false"></Field>
   </Fields>
  </List>

 </DataMapping>
</Configuration>

 

 

Do you think anyone can pinpoint my problem from this description? I tried adding a single item to one of the lists also, but nothing happened.

 

Hope someone can help me out here.

 

Thanks.

Jan 29, 2013 at 8:25 AM

Also, I failed to mention that all the fields are created correctly, both on the db and in the sharepoint list. There is a Slam ID field for keying on both sides. It just wont save any values on the DB. 

Developer
Jan 29, 2013 at 4:24 PM

I'm surprised it would not be able to match a profile and also add the SLAM ID field to each list.  Usually that sort of error is thrown when there are Site or SiteCollection values incorrect or missing.  Even though config validation is not showing any problems, are these lists really in the top site of your root site collection?

Feb 15, 2013 at 1:28 PM
Edited Feb 15, 2013 at 4:41 PM
No. The lists im handling right now are in http://xxxxxxxxx/sites/Geologia But I tried adding the Site parameter to the XML and got the same error. The XML is a LOT bigger now and all the fields and tables were created successfully in the SQL DB.
I tried removing the Synchronous option, as it is not totally necessary, but it didnt help.
There are 31 tables being created correctly on the SQL DB. I didnt add FKs and whatnot yet, but the error I`m getting in each table is :
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()
Developer
Feb 15, 2013 at 6:23 PM
If everything is in /sites/Geologia then you need to set SiteCollection in DataMapping.

So in the above you would have <DataMapping DataSchema="SLAM" SiteCollection="sites/Geologia" TypeIdDefinition="Global" SynchronousUpdates="true">
And you would not have a Site values in the List nodes.
Feb 15, 2013 at 6:48 PM
Thank you so much, brjenkins.

I managed to sinchronize after i corrected the XML. At least it completes without errors. But the list items from sharepoint are not transfered to the SQL DB.

I get a message such as this for every table:
2/15/2013 5:39:37 PM Information Data Synchronization Cleanup: Cimento
2/15/2013 5:39:37 PM Information Number of items removed from cimento: 0
2/15/2013 5:39:37 PM Information Update Table: begin if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'ListItemID') ALTER TABLE [dbo].[cimento] ADD [ListItemID] [uniqueidentifier] not null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'ListID') ALTER TABLE [dbo].[cimento] ADD [ListID] [uniqueidentifier] not null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'ListRelativeID') ALTER TABLE [dbo].[cimento] ADD [ListRelativeID] [int] not null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'cimento') ALTER TABLE [dbo].[cimento] ADD [cimento] varchar null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'codigo') ALTER TABLE [dbo].[cimento] ADD [codigo] varchar null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'criadoPor') ALTER TABLE [dbo].[cimento] ADD [criadoPor] varchar null; if NOT EXISTS( select 1 FROM information_schema.columns c WHERE (c.table_schema + '.' + c.table_name) = 'dbo.cimento' and c.column_name = 'modificadoPor') ALTER TABLE [dbo].[cimento] ADD [modificadoPor] varchar null; end
2/15/2013 5:39:37 PM Information Processing Cimento
Am I doing something wrong? The Synchronization button on the config page should replicate the items on the lists or was it supposed to work with fields only?

This is part of my current XML:
<?xml version="1.0" encoding="utf-8" ?>

<Configuration>
 <ConnectionStrings Default="SLAM">
  <add Name="SLAM" ConnectionString="Database=GeologiaDB;Data Source=s01dbhm06\spfarm03dev; Integrated Security=SSPI" />
 </ConnectionStrings>
 
 <TypeIdDefinitions>
  <add Name="Global" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Int" ReplaceSharePointIds="true" />
  <add Name="GlobalWithSharePointIDs" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="false" />
 </TypeIdDefinitions>

 <DataMapping DataSchema="dbo" SiteCollection="sites/Geologia" TypeIdDefinition="WithSharePointIDs" SynchronousUpdates="true">

 <!-- <List Site="Geologia" Name="Amostras de Calha" TableName="amostracalha" ActivationOrder="1">
   <Fields>
    <Field Name="Litologia" SqlType="varchar(255)" Column="Litologia" SPType="Text" Required="true"></Field>
   </Fields>
  </List>-->
  
    <List Name="Amostras de Calha" TableName="amostracalha" ActivationOrder="1">
       <Fields>
        <Field Name="Title" SqlType="varchar(255)" Column="poco" SPType="Text" Required="false"></Field>
        <Field Name="Litologia" SqlType="varchar(255)" Column="litologia" SPType="Text" Required="false"></Field>
        <Field Name="Fase" SqlType="varchar(255)" Column="fase" SPType="Text" Required="false"></Field>
        <Field Name="percentual" SqlType="varchar(255)" Column="percentual" SPType="Text" Required="false"></Field>
        <Field Name="Cor" SqlType="varchar(255)" Column="cor" SPType="Text" Required="false"></Field>
        <Field Name="Tonalidade" SqlType="varchar(255)" Column="tonalidade" SPType="Text" Required="false"></Field>
        <Field Name="Granulometria" SqlType="varchar(255)" Column="granulometria" SPType="Text" Required="false"></Field>
        <Field Name="Arredondamento" SqlType="varchar(255)" Column="arredondamento" SPType="Text" Required="false"></Field>
        <Field Name="Seleção" SqlType="varchar(255)" Column="selecao" SPType="Text" Required="false"></Field>
        <Field Name="Cristalinidade" SqlType="varchar(255)" Column="cristalinidade" SPType="Text" Required="false"></Field>
        <Field Name="Textura" SqlType="varchar(255)" Column="textura" SPType="Text" Required="false"></Field>
        <Field Name="Estrutura" SqlType="varchar(255)" Column="estrutura" SPType="Text" Required="false"></Field>
        <Field Name="ComposicaoPrincipal" SqlType="varchar(255)" Column="composicaoprincipal" SPType="Text" Required="false"></Field>
        <Field Name="ComposicaoAcessoria" SqlType="varchar(255)" Column="composicaoacessoria" SPType="Text" Required="false"></Field>
        <Field Name="Matriz" SqlType="varchar(255)" Column="matriz" SPType="Text" Required="false"></Field>
        <Field Name="Cimento" SqlType="varchar(255)" Column="cimento" SPType="Text" Required="false"></Field>
        <Field Name="Porosidade" SqlType="varchar(255)" Column="porosidade" SPType="Text" Required="false"></Field>
        <Field Name="Coesao" SqlType="varchar(255)" Column="coesao" SPType="Text" Required="false"></Field>
        <Field Name="Dureza" SqlType="varchar(255)" Column="dureza" SPType="Text" Required="false"></Field>
        <Field Name="Fluorecência - Tipo" SqlType="varchar(255)" Column="fluorecenciaTipo" SPType="Text" Required="false"></Field>
        <Field Name="Fluorecência - %" SqlType="varchar(255)" Column="fluorecenciaPercentagem" SPType="Text" Required="false"></Field>
        <Field Name="Fluorecência - Cor" SqlType="varchar(255)" Column="fluorecenciaCor" SPType="Text" Required="false"></Field>
        <Field Name="Fluorecencia - Tonalidade" SqlType="varchar(255)" Column="fluorecenciaTonalidade" SPType="Text" Required="false"></Field>
        <Field Name="Corte - Velocidade" SqlType="varchar(255)" Column="corteVelocidade" SPType="Text" Required="false"></Field>
        <Field Name="Corte - Modo" SqlType="varchar(255)" Column="corteModo" SPType="Text" Required="false"></Field>
        <Field Name="Observacao" SqlType="varchar(255)" Column="observacao" SPType="Text" Required="false"></Field>
        <Field Name="Topo" SqlType="varchar(255)" Column="topo" SPType="Text" Required="false"></Field>
        <Field Name="Profundidade" SqlType="varchar(255)" Column="profundidade" SPType="Text" Required="false"></Field>
        <Field Name="Intervalo" SqlType="varchar(255)" Column="intervalo" SPType="Text" Required="false"></Field>
        <Field Name="LitologiaID" SqlType="varchar(255)" Column="litologiaID" SPType="Text" Required="false"></Field>
        <Field Name="Title" SqlType="varchar(255)" Column="pocoLookup" SPType="Text" Required="false"></Field>
        <Field Name="Created By" SqlType="varchar(255)" Column="criadoPor" SPType="Text" Required="false"></Field>
        <Field Name="Modified By" SqlType="varchar(255)" Column="modificadoPor" SPType="Text" Required="false"></Field>
       </Fields>
      </List>  
      
    <List  Name="Cimento" TableName="cimento" ActivationOrder="2">
       <Fields>
        <Field Name="Title" SqlType="varchar(255)" Column="cimento" SPType="Text" Required="false"></Field>
        <Field Name="codigo" SqlType="varchar(255)" Column="codigo" SPType="Text" Required="false"></Field>
        <Field Name="Created By" SqlType="varchar(255)" Column="criadoPor" SPType="Text" Required="false"></Field>
        <Field Name="Modified By" SqlType="varchar(255)" Column="modificadoPor" SPType="Text" Required="false"></Field>
       </Fields>
      </List>
        
    <List  Name="Cor" TableName="cor" ActivationOrder="3">
       <Fields>
        <Field Name="Title" SqlType="varchar(255)" Column="cor" SPType="Text" Required="false"></Field>
        <Field Name="codigo" SqlType="varchar(255)" Column="codigo" SPType="Text" Required="false"></Field>
        <Field Name="Created By" SqlType="varchar(255)" Column="criadoPor" SPType="Text" Required="false"></Field>
        <Field Name="Modified By" SqlType="varchar(255)" Column="modificadoPor" SPType="Text" Required="false"></Field>
       </Fields>
      </List>

    <List  Name="Fase" TableName="fase" ActivationOrder="4">
       <Fields>
        <Field Name="Simbolo" SqlType="varchar(255)" Column="simbolo" SPType="Text" Required="false"></Field>
        <Field Name="Valor" SqlType="varchar(255)" Column="valor" SPType="Text" Required="false"></Field>
        <Field Name="Created By" SqlType="varchar(255)" Column="criadoPor" SPType="Text" Required="false"></Field>
        <Field Name="Modified By" SqlType="varchar(255)" Column="modificadoPor" SPType="Text" Required="false"></Field>
       </Fields>
      </List>
      
    <List  Name="Tipo de Recuperação" TableName="tipoRecuperacao" ActivationOrder="5">
Developer
Feb 15, 2013 at 6:55 PM
After correcting your xml did you activate again?

If you do that, what happens if you add/update a single item?