0

i am using sitecore 9.0.2 Commerce, On Application startup, i am getting Below ERROR on the log file.

604 17:29:16 INFO  Commerce.Connector - Acquiring mapping lock
9604 17:29:16 INFO  Commerce.Connector - Mapping locked
9604 17:29:16 INFO  Commerce.Connector - Loading the mapping entries
9604 17:29:16 INFO  Commerce.Connector - Attempting to connect to CE
23996 17:29:16 ERROR GetCatalogItems(environmentName='CommerceAuthoring',skip=0,take=100)?$expand=CatalogItems($select=Id,SitecoreId,CatalogToEntityList,ParentCatalogList,ParentCategoryList,ChildrenCategoryList,ChildrenSellableItemList,ItemVariations)
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Commerce.Engine.Connect.DataProvider.CatalogRepository.<InvokeHttpClientGetAsync>d__31.MoveNext()
9604 17:29:16 ERROR Commerce.Connector - There was an error retrieving the mappings from the Commerce Service
9604 17:29:16 INFO  Commerce.Connector - Loaded the mapping entries - 0 Entries, 0 Parents 0 Templates
9604 17:29:16 INFO  Commerce.Connector - Release mapping lock

i have created the commerceengine certificate and added in Trusted Root and Personal.

Below is my Sitecore.Commerce.Engine.Connect.Config

> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
> xmlns:role="http://www.sitecore.net/xmlconfig/role/">   <sitecore
> role:require="Standalone or ContentDelivery or ContentManagement">
>     <commerceEngineConfiguration type="Sitecore.Commerce.Engine.Connect.CommerceEngineConfiguration,
> Sitecore.Commerce.Engine.Connect">
>       <shopsServiceUrl>https://localhost:5000/api/</shopsServiceUrl>
>       <commerceOpsServiceUrl>https://localhost:5000/commerceops/</commerceOpsServiceUrl>
>       <commerceRequestTimeout>120</commerceRequestTimeout>
>       <enforceSsl>true</enforceSsl>
>       <defaultEnvironment>CommerceAuthoring</defaultEnvironment>
>       <defaultShopName>CommerceEngineDefaultStorefront</defaultShopName>
>       <defaultShopCurrency>USD</defaultShopCurrency>
>       <certificateThumbprint>C1C7159CA462E88330D38E3FDA47198CC785F9BF</certificateThumbprint>
>       <!-- StoreLoctions: 
>         CurrentUser = 1
>         LocalMachine = 2
>       -->
>       <certificateStoreLocation>2</certificateStoreLocation>
>       <!-- StoreNames: 
>         AddressBook = 1
>         AuthRoot = 2
>         CertificateAuthority = 3
>         Disallowed = 4
>         My = 5
>         Root = 6
>         TrustedPeople = 7
>         TrustedPublisher = 8
>       -->
>       <certificateStoreName>5</certificateStoreName>
>       <certificateHeaderName>X-CommerceEngineCert</certificateHeaderName>
>       <!-- Catalog Template Generator Settings -->
>       <useDeterministicFieldIdsForEntities>true</useDeterministicFieldIdsForEntities>
>       <useDeterministicFieldIdsForComponents>true</useDeterministicFieldIdsForComponents>
>     </commerceEngineConfiguration>
>     <commands>
>       <command name="commerce:generatecatalogdatatemplates" type="Sitecore.Commerce.Engine.Connect.DataProvider.Commands.GenerateTemplatesCommand,
> Sitecore.Commerce.Engine.Connect" />
>       <command name="commerce:deletecatalogdatatemplates" type="Sitecore.Commerce.Engine.Connect.DataProvider.Commands.DeleteTemplatesCommand,
> Sitecore.Commerce.Engine.Connect" />
>       <command name="commerce:refreshcache" type="Sitecore.Commerce.Engine.Connect.DataProvider.Commands.RefreshCacheCommand,
> Sitecore.Commerce.Engine.Connect" />
>     </commands>
>     <pipelines>
>       <commerce.viewaction.getentityview>
>         <processor type="Sitecore.Commerce.Engine.Connect.Pipelines.ViewAction.GetEntityView, Sitecore.Commerce.Engine.Connect" />
>       </commerce.viewaction.getentityview>
>       <commerce.viewaction.doaction>
>         <processor type="Sitecore.Commerce.Engine.Connect.Pipelines.ViewAction.DoAction,
> Sitecore.Commerce.Engine.Connect" />
>       </commerce.viewaction.doaction>
>       <getContentEditorFields>
>         <processor type="Sitecore.Commerce.Engine.Connect.SitecoreDataProvider.Pipelines.ContentEditor.CommerceContentEditorFieldsProcessor,
> Sitecore.Commerce.Engine.Connect" />
>       </getContentEditorFields>
>       <renderContentEditor>
>         <processor patch:before="processor[1]" type="Sitecore.Commerce.Engine.Connect.DataProvider.Pipelines.SetCommerceEditorFormatter,
> Sitecore.Commerce.Engine.Connect" />
>       </renderContentEditor>
>       <getQueryState>
>         <processor type="Sitecore.Commerce.Engine.Connect.DataProvider.Pipelines.ContentEditor.CommandStateProcessor,
> Sitecore.Commerce.Engine.Connect" />
>       </getQueryState>
>       <getContentEditorWarnings>
>         <processor type="Sitecore.Commerce.Engine.Connect.Pipelines.ValidateCertificate,
> Sitecore.Commerce.Engine.Connect" />
>       </getContentEditorWarnings>
>       <getItemPersonalizationVisibility>
>         <processor type="Sitecore.Commerce.Engine.Connect.Pipelines.PersonalizationVisibilityProcessor,
> Sitecore.Commerce.Engine.Connect" />
>       </getItemPersonalizationVisibility>
>     </pipelines>
>     <events>
>       <event name="publish:itemProcessing">
>         <handler type="Sitecore.Commerce.Engine.Connect.Events.CatalogPublishingExcluderEvent,
> Sitecore.Commerce.Engine.Connect" method="CheckProcessing" />
>       </event>
>       <event name="publish:end">
>         <handler patch:after="processor[@type='Sitecore.Publishing.HtmlCacheClearer,
> Sitecore.Kernel']"
> type="Sitecore.Commerce.Engine.Connect.Events.CommercePublishCacheRefresh, Sitecore.Commerce.Engine.Connect" method="ClearCache" />
>       </event>
>       <event name="publish:end:remote">
>         <handler patch:after="processor[@type='Sitecore.Publishing.HtmlCacheClearer,
> Sitecore.Kernel']"
> type="Sitecore.Commerce.Engine.Connect.Events.CommercePublishCacheRefresh, Sitecore.Commerce.Engine.Connect" method="ClearCache" />
>       </event>
>       <event name="item:saved">
>         <handler type="Sitecore.Commerce.Engine.Connect.Events.CommerceItemEventHandler,
> Sitecore.Commerce.Engine.Connect" method="OnItemSaved" />
>       </event>
>       <event name="item:deleting">
>         <handler type="Sitecore.Commerce.Engine.Connect.Events.CommerceItemEventHandler,
> Sitecore.Commerce.Engine.Connect" method="OnItemDeleting" />
>       </event>
>       <event name="indexing:completed:remote" role:require="Standalone or ContentDelivery">
>         <handler type="Sitecore.Commerce.Engine.Connect.Events.IndexingCompletedEventHandler,
> Sitecore.Commerce.Engine.Connect" method="OnIndexingCompleted" />
>       </event>
>     </events>
>     <hooks role:require="Standalone or ContentDelivery">
>       <hook type="Sitecore.Commerce.Engine.Connect.Events.IndexingCompletedHook,
> Sitecore.Commerce.Engine.Connect" />
>     </hooks>
>     <settings>
>       <setting name="Sitecore.Services.SecurityPolicy">
>         <patch:attribute name="value">Sitecore.Services.Infrastructure.Web.Http.Security.ServicesOnPolicy,
> Sitecore.Services.Infrastructure</patch:attribute>
>       </setting>
>     </settings>   </sitecore> </configuration>
1

To Add some points in the above answer also check Thumbprint in config.json (..\CommerceAuthoring_Sc9\wwwroot\config.json) like below. This should be the same certificateThumbprint as in Sitecore.Commerce.Engine.Connect.Config -

"Certificates": {
    "Certificates": [
      {
        "Thumbprint": "C1C7159CA462E88330D38E3FDA47198CC785F9BF",
        "DefaultRoles": [
          "sitecore\\QA",
          "sitecore\\Commerce Business User"
        ]
      }
    ],
    "CertificateHeaderName": "X-CommerceEngineCert"
  },

And after doing this change also make sure to recycle app pool.

| improve this answer | |
0

Here are some of the steps to troubleshoot this issue

  1. Check to see if commerce engine metadata specified in shopsServiceUrl is accessable. For example shopsServiceUrl https://localhost:5000/CommerceOps/$metadata#Commands/$entity will need to be validated)
  2. Go to sitecore and login there and navigate to admin/showconfig.aspx and find the ShopsService and commerceOpsServiceUrl should point to https://localhost:5000
  3. Authroing environment must be configured with correct SSL certificate. check for if the certificate is valid when you browse https://localhost:5000/CommerceOps/$metadata#Commands/$entity. Refer to https://blog.ryanbailey.co.nz/2017/09/sitecore-tds-remote-certificate-is.html for troubleshooting this.
  4. The certificate should not be in multiple store locations. Check if the certificate is in both User and local machine section.If so , remove the certificate from current user.
  5. The value of certificateStoreLocation must be 5 if the certificate is in Personal location.
  6. Make sure currentAppPool of authoring web site have permission to access the certificate.
  7. Reset IIS or App pool recycle after performing the above activities.
| improve this answer | |

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.