1

My installation for Sitecore Commerce is failing at the GenerateCatalogTemplates step. I have Sitecore 9.0 update 2 and am attempting to install Sitecore Commerce 9.0 update 3.

The PowerShell prompt has the following output:

Importing Module => SitecoreUtilityTasks

[--------------------------------------------------------------------------------- GenerateCatalogTemplates : GenerateCatalogTemplates ---------------------------------------------------------------------------------]
Generating Catalog Templates ...
Install-SitecoreConfiguration :

        Object reference not set to an instance of an object.


         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }



            Server Error in '/' Application.
             Object reference not set to an instance of an object.

             Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

             Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
            Source Error:




An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.




            Stack Trace:




[NullReferenceException: Object reference not set to an instance of an object.]
   Sitecore.Commerce.Engine.Connect.DataProvider.CatalogRepository.GetEntityIdFromMappings(String sitecoreId) +100
   Sitecore.Commerce.Engine.Connect.DataProvider.ReadOnlyCatalogDataProvider.GetItemDefinition(ID itemId, CallContext context) +177
   Sitecore.Data.DataProviders.DataProvider.GetItemDefinition(ID itemID, CallContext context, DataProviderCollection providers) +146
   Sitecore.Data.DataSource.GetItemInformation(ID itemID) +87
   Sitecore.Data.DataSource.GetItemDefinition(ID itemID) +18
   Sitecore.Data.Engines.TemplateEngine.LoadItemBasedTemplate(ID templateId) +40
   Sitecore.Data.Engines.TemplateEngine.AddItemBasedTemplates(TemplateDictionary result) +196
   Sitecore.Data.Engines.TemplateEngine.InternalGetTemplates() +492
   Sitecore.Data.Engines.TemplateEngine.GetTemplate(ID templateId) +190
   Sitecore.XA.Foundation.SitecoreExtensions.Extensions.<GetContentItemsOfTemplate>d__0.MoveNext() +170
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +436
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +69
   Sitecore.XA.Foundation.Multisite.SiteResolvers.EnvironmentSitesResolver.ResolveAllSites(Database database) +81
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSiteList() +159
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.InitializeSites() +78
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSites() +18
   System.Linq.<SelectManyIterator>d__17`2.MoveNext() +262
   Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites) +137
   Sitecore.Sites.SitecoreSiteProvider.GetSites() +218
   Sitecore.Sites.DefaultSiteContextFactory.GetSites() +253
   Sitecore.XA.Foundation.Multisite.SiteInfoResolver.get_Sites() +60
   Sitecore.XA.Feature.Search.Pipelines.Initialize.InitializeRouting.Process(PipelineArgs args) +60
   (Object , Object ) +9
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Nexus.Web.HttpModule.Application_Start() +161
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +767
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +581
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369
[HttpException (0x80004005): Object reference not set to an instance of an object.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714





            Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3429.0


d__0.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.XA.Foundation.Multisite.SiteResolvers.EnvironmentSitesResolver.ResolveAllSites(Database database)
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSiteList()
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.InitializeSites()
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSites()
   at System.Linq.Enumerable.d__17`2.MoveNext()
   at Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites)
   at Sitecore.Sites.SitecoreSiteProvider.GetSites()
   at Sitecore.Sites.DefaultSiteContextFactory.GetSites()
   at Sitecore.XA.Foundation.Multisite.SiteInfoResolver.get_Sites()
   at Sitecore.XA.Feature.Search.Pipelines.Initialize.InitializeRouting.Process(PipelineArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Nexus.Web.HttpModule.Application_Start()
   at Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
[HttpException]: Object reference not set to an instance of an object.
   at System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
   at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
-->
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.2.1\Public\Install-SitecoreConfiguration.ps1:253 char:21
+                     & $entry.Task.Command @paramSet | Out-Default
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

This doesn't tell us very much, but checking the Sitecore logs show

27700 00:06:32 ERROR Authentication Error
Exception: System.Exception
Message: The certificate thumbprint is invalid or missing from your configuration, secure communication with the Commerce Engine is not possible.

ManagedPoolThread #6 00:06:32 ERROR An error occurred while loading mapping entries: System.NullReferenceException: Object reference not set to an instance of an object.
   at Sitecore.Commerce.Engine.Connect.DataProvider.CatalogRepository.LoadMappingEntries()
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Commerce.Engine.Connect
   at Sitecore.Commerce.Engine.Connect.DataProvider.CatalogRepository.LoadMappingEntries()

ManagedPoolThread #6 00:06:32 INFO  Commerce.Connector - Release mapping lock
ManagedPoolThread #6 00:06:32 ERROR Exception
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Commerce.Engine.Connect
   at Sitecore.Commerce.Engine.Connect.DataProvider.CatalogRepository.GetEntityIdFromMappings(String sitecoreId)
   at Sitecore.Commerce.Engine.Connect.DataProvider.ReadOnlyCatalogDataProvider.GetItemDefinition(ID itemId, CallContext context)
   at Sitecore.Data.DataProviders.DataProvider.GetItemDefinition(ID itemID, CallContext context, DataProviderCollection providers)
   at Sitecore.Data.DataSource.GetItemInformation(ID itemID)
   at Sitecore.Data.DataSource.GetItemDefinition(ID itemID)
   at Sitecore.Data.Engines.TemplateEngine.LoadItemBasedTemplate(ID templateId)
   at Sitecore.Data.Engines.TemplateEngine.AddItemBasedTemplates(TemplateDictionary result)
   at Sitecore.Data.Engines.TemplateEngine.InternalGetTemplates()
   at Sitecore.Data.Engines.TemplateEngine.GetTemplate(ID templateId)
   at Sitecore.XA.Foundation.SitecoreExtensions.Extensions.DatabaseExtensions.d__0.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.XA.Foundation.Multisite.SiteResolvers.EnvironmentSitesResolver.ResolveAllSites(Database database)
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSiteList()
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.InitializeSites()
   at Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSites()
   at System.Linq.Enumerable.d__17`2.MoveNext()
   at Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites)
   at Sitecore.Sites.SitecoreSiteProvider.GetSites()
   at Sitecore.Sites.DefaultSiteContextFactory.GetSites()
   at Sitecore.Sites.DefaultSiteContextFactory.GetSiteInfo(String name)
   at Sitecore.Sites.DefaultSiteContextFactory.GetSiteContext(String name)
   at Sitecore.Context.SetActiveSite(String siteName)
   at Sitecore.Jobs.JobRunner.InitializeContext(JobArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Jobs.Job.DoExecute()
   at Sitecore.Jobs.Job.ThreadEntry(Object state)

This is a certificate thumbprint error. I think it's the same thing being reported here. I tried the suggested answer, but it did not fix the problem. As per that answer I checked the <certificateThumbprint> value in C:\inetpub\wwwroot\mysite.local\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config and verified that it matches the certificate thumbprint value in the following files

  • CommerceAuthoring_Sc9\wwwroot\config.json
  • CommerceMinions_Sc9\wwwroot\config.json
  • CommerceOps_Sc9\wwwroot\config.json
  • CommerceShops_Sc9\wwwroot\config.json

The certificate thumbprint corresponds to the "storefront.local" certificate. I have also tried the thumbprints for "mysite.local" and "localhost" (the one which is used as there are two localhost certificates).

In IIS:

mysite.local has http and https bindings for mysite.local and storefront.local. The https bindings both reference the certificate mysite.local.

CommerceAuthoring_Sc9, CommerceMinions_Sc9, CommerceOps_Sc9 and CommerceShops_Sc9 have only https bindings for localhost (with ports 5000, 5010, 5015 and 5005 respectively) each of these sites reference the certificate "Sitecore Commerce Services SSL Certificate" (which shows as localhost in MMC).

In MMC I looked at Certificates (Local Computer)\Personal\Computer and could not find "Sitecore Commerce Services SSL Certificate". I ran the PowerShell command

cd CERT:\\
dir -recurse | where {$_.FriendlyName -eq "Sitecore Commerce Services SSL Certificate"} | Format-List -Property *

which returned

PSPath                   : Microsoft.PowerShell.Security\Certificate::LocalMachine\My\C6521297654346EDDEE6C289F6907F40C
                           3C1352A
PSParentPath             : Microsoft.PowerShell.Security\Certificate::LocalMachine\My
PSChildName              : C6521297654346EDDEE6C289F6907F40C3C1352A
PSDrive                  : Cert
PSProvider               : Microsoft.PowerShell.Security\Certificate
PSIsContainer            : False
EnhancedKeyUsageList     : {Client Authentication (1.3.6.1.5.5.7.3.2), Server Authentication (1.3.6.1.5.5.7.3.1)}
DnsNameList              : {localhost}
SendAsTrustedIssuer      : False
EnrollmentPolicyEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
EnrollmentServerEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
PolicyId                 :
Archived                 : False
Extensions               : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
                           System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
FriendlyName             : Sitecore Commerce Services SSL Certificate
IssuerName               : System.Security.Cryptography.X509Certificates.X500DistinguishedName
NotAfter                 : 03/08/2020 16:05:26
NotBefore                : 05/08/2019 14:54:25
HasPrivateKey            : True
PrivateKey               : System.Security.Cryptography.RSACryptoServiceProvider
PublicKey                : System.Security.Cryptography.X509Certificates.PublicKey
RawData                  : {48, 130, 3, 148...}
SerialNumber             : 27EBAE913107D1854408E5D4E64E5997
SubjectName              : System.Security.Cryptography.X509Certificates.X500DistinguishedName
SignatureAlgorithm       : System.Security.Cryptography.Oid
Thumbprint               : C6521297654346EDDEE6C289F6907F40C3C1352A
Version                  : 3
Handle                   : 2765686865360
Issuer                   : CN=DO_NOT_TRUST_SitecoreRootCert, O=DO_NOT_TRUST, OU=Created by https://www.sitecore.net
Subject                  : CN=localhost

This is the "localhost" certificate. There are actually two localhost certificates in the above folder in MMC. Do I need to delete one of them? Which certificate thumbprint actually needs to be used in the above config settings?

3
+250

If you are receiving this error it means you either have the wrong certificate's thumbprint referenced in your configs (or the thumbprints are not all the same), or the user account of the IIS AppPool used for the commerce services does not have correct access to the certificates.

How to check you are using the right thumbprint:

The certificate/thumbprint in question is the one you should have generated in step 2.3 of http://commercesdn.sitecore.net/SitecoreXC_9.0/Installation-Guide/9.0.3/Sitecore_Experience_Commerce_Installation_Guide_for_On-Premise_9.0.3.pdf

This certificate should not be used with any site bindings in IIS. The thumbprint value needs to be referenced in the following files:

  • C:\inetpub\wwwroot\sitecore9site\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config
  • C:\inetpub\wwwroot\CommerceAuthoring_Sc9\wwwroot\config.json
  • C:\inetpub\wwwroot\CommerceMinions_Sc9\wwwroot\config.json
  • C:\inetpub\wwwroot\CommerceOps_Sc9\wwwroot\config.json
  • C:\inetpub\wwwroot\CommerceShops_Sc9\wwwroot\config.json

How to check the IIS AppPool account access:

Check the site CommerceAuthoring_Sc9. By default it should have an app pool called CommerceAuthoring_Sc9. Check the app pool, by default it should have the identity "{MachineName}\CSFndRuntimeUser".

For completeness check CommerceMinions_Sc9, CommerceOps_Sc9, CommerceShops_Sc9; they should all have the same app pool identity.

Now open MMC. Open Certificates (Local Computer)\Personal\Certificates and locate the certificate. Double-check its thumbprint.

With the certificate selected, in the "Actions" pane, click "More Actions" > "All Tasks" > "Manage Private Keys...". In the security dialog, you should see that "CSFndRuntimeUser" has "Full control" and "Read" access, if not, try to add the account and select those permissions.

With these changes made, you can re-run the installation (you can comment-out previous successful steps in {YourCommerceInstallFolder}\SIF.Sitecore.Commerce.1.4.7\Configuration\Commerce\Master_SingleServer.json to skip repeating steps which have already been completed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.