Skip to main content
added 246 characters in body
Source Link
Corey Burnett
  • 3.4k
  • 3
  • 20
  • 36

I have a Sitecore 8.1 CD server. I have a page where a user can create a new shipping address and save it back to the Master database. I am using Glass Mapper for this. Here is my code:

Models.sitecore.templates.myProject.Non_Page_Templates.Address newAddress = new Models.sitecore.templates.
    myProject.Non_Page_Templates.Address
{
    ItemName = Utility.GetValidSitecoreItemName(user.Profile.UserName + "-" + address.Address1),
    First_Name = address.FirstName,
    Middle_Name = address.MiddleName,
    Last_Name = address.LastName,
    Company = address.Organization,
    Phone = address.PhoneNumber,
    Phone_Extension = address.PhoneExtension,
    Address_1 = address.Address1,
    Address_2 = address.Address2,
    City = address.City,
    State = address.State,
    Zip_Code = address.Zip,
    Country = address.Country
};

When I try to run this on a CD server I get the following error:

Glass.Mapper.MapperException: Failed to find configuration for parent item type Sitecore.Data.Items.Item ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Glass.Mapper.Context.GetTypeConfiguration[T](Object obj, Boolean doNotLoad, Boolean checkBase) at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent) --- End of inner exception stack trace --- at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent)

My guess is that something I did when configuring the server as a CD server is causing this. I followed all of the instructions for removing access to the Master database. But I need access to the Master database because I do have some code here and there that adds content items to the Master database (placing orders and stuff).

So I'm not 100% entirely sure exactly what I need to re-enable on a CD server to give me full access to Master.

Any ideas?

EDIT: Here is the LinkDatabase section of my configuration

<!--  LINK DATABASE  -->
<LinkDatabase type="Sitecore.Data.SqlServer.SqlServerLinkDatabase, Sitecore.Kernel">
<param connectionStringName="core"/>
</LinkDatabase>

I have a Sitecore 8.1 CD server. I have a page where a user can create a new shipping address and save it back to the Master database. I am using Glass Mapper for this. Here is my code:

Models.sitecore.templates.myProject.Non_Page_Templates.Address newAddress = new Models.sitecore.templates.
    myProject.Non_Page_Templates.Address
{
    ItemName = Utility.GetValidSitecoreItemName(user.Profile.UserName + "-" + address.Address1),
    First_Name = address.FirstName,
    Middle_Name = address.MiddleName,
    Last_Name = address.LastName,
    Company = address.Organization,
    Phone = address.PhoneNumber,
    Phone_Extension = address.PhoneExtension,
    Address_1 = address.Address1,
    Address_2 = address.Address2,
    City = address.City,
    State = address.State,
    Zip_Code = address.Zip,
    Country = address.Country
};

When I try to run this on a CD server I get the following error:

Glass.Mapper.MapperException: Failed to find configuration for parent item type Sitecore.Data.Items.Item ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Glass.Mapper.Context.GetTypeConfiguration[T](Object obj, Boolean doNotLoad, Boolean checkBase) at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent) --- End of inner exception stack trace --- at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent)

My guess is that something I did when configuring the server as a CD server is causing this. I followed all of the instructions for removing access to the Master database. But I need access to the Master database because I do have some code here and there that adds content items to the Master database (placing orders and stuff).

So I'm not 100% entirely sure exactly what I need to re-enable on a CD server to give me full access to Master.

Any ideas?

I have a Sitecore 8.1 CD server. I have a page where a user can create a new shipping address and save it back to the Master database. I am using Glass Mapper for this. Here is my code:

Models.sitecore.templates.myProject.Non_Page_Templates.Address newAddress = new Models.sitecore.templates.
    myProject.Non_Page_Templates.Address
{
    ItemName = Utility.GetValidSitecoreItemName(user.Profile.UserName + "-" + address.Address1),
    First_Name = address.FirstName,
    Middle_Name = address.MiddleName,
    Last_Name = address.LastName,
    Company = address.Organization,
    Phone = address.PhoneNumber,
    Phone_Extension = address.PhoneExtension,
    Address_1 = address.Address1,
    Address_2 = address.Address2,
    City = address.City,
    State = address.State,
    Zip_Code = address.Zip,
    Country = address.Country
};

When I try to run this on a CD server I get the following error:

Glass.Mapper.MapperException: Failed to find configuration for parent item type Sitecore.Data.Items.Item ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Glass.Mapper.Context.GetTypeConfiguration[T](Object obj, Boolean doNotLoad, Boolean checkBase) at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent) --- End of inner exception stack trace --- at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent)

My guess is that something I did when configuring the server as a CD server is causing this. I followed all of the instructions for removing access to the Master database. But I need access to the Master database because I do have some code here and there that adds content items to the Master database (placing orders and stuff).

So I'm not 100% entirely sure exactly what I need to re-enable on a CD server to give me full access to Master.

Any ideas?

EDIT: Here is the LinkDatabase section of my configuration

<!--  LINK DATABASE  -->
<LinkDatabase type="Sitecore.Data.SqlServer.SqlServerLinkDatabase, Sitecore.Kernel">
<param connectionStringName="core"/>
</LinkDatabase>
Source Link
Corey Burnett
  • 3.4k
  • 3
  • 20
  • 36

Trouble creating content item using Glass Mapper on a CD server

I have a Sitecore 8.1 CD server. I have a page where a user can create a new shipping address and save it back to the Master database. I am using Glass Mapper for this. Here is my code:

Models.sitecore.templates.myProject.Non_Page_Templates.Address newAddress = new Models.sitecore.templates.
    myProject.Non_Page_Templates.Address
{
    ItemName = Utility.GetValidSitecoreItemName(user.Profile.UserName + "-" + address.Address1),
    First_Name = address.FirstName,
    Middle_Name = address.MiddleName,
    Last_Name = address.LastName,
    Company = address.Organization,
    Phone = address.PhoneNumber,
    Phone_Extension = address.PhoneExtension,
    Address_1 = address.Address1,
    Address_2 = address.Address2,
    City = address.City,
    State = address.State,
    Zip_Code = address.Zip,
    Country = address.Country
};

When I try to run this on a CD server I get the following error:

Glass.Mapper.MapperException: Failed to find configuration for parent item type Sitecore.Data.Items.Item ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at Glass.Mapper.Context.GetTypeConfiguration[T](Object obj, Boolean doNotLoad, Boolean checkBase) at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent) --- End of inner exception stack trace --- at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent)

My guess is that something I did when configuring the server as a CD server is causing this. I followed all of the instructions for removing access to the Master database. But I need access to the Master database because I do have some code here and there that adds content items to the Master database (placing orders and stuff).

So I'm not 100% entirely sure exactly what I need to re-enable on a CD server to give me full access to Master.

Any ideas?