Technote (troubleshooting)
Problem(Abstract)
Catalog entry is not valid for the current contract.
Symptom
You repeatedly find errors reported in the log similar to this:
[9/20/12 13:04:04:099 EEST] 00000e5b CommerceSrvr A com.ibm.commerce.order.commands.PreProcessOrderCmdImpl validateContract The catalog entry number "1098765" and part number "1223456" is not valid for the current contract.
... and particular items can not be added to the cart or sometimes it just stops orders from being submitted.
Cause
It seems that a language id taken from the globalization context can sometimes be incorrect and this results in the wrong index being queried.
Diagnosing the problem
Enable Solr tracing (see Information Center article: Enabling tracing and logging for WebSphere Commerce search). You will see the following lines in the trace which show the language id chosen:
[9/20/12 20:58:00:774 EEST] 00001004 solr 1 com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchIndexNameValidator invoke(SelectionCriteria) Core name (from expression): null
[9/20/12 20:58:00:774 EEST] 00001004 solr 1 com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchIndexNameValidator invoke(SelectionCriteria) Index name (from profile): CatalogEntry
[9/20/12 20:58:00:774 EEST] 00001004 solr 1 com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchIndexNameValidator invoke(SelectionCriteria) Store Id: 10001
[9/20/12 20:58:00:774 EEST] 00001004 solr 1 com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchIndexNameValidator invoke(SelectionCriteria) Language Id: -1
[9/20/12 20:58:00:774 EEST] 00001004 solr 1 com.ibm.commerce.catalog.facade.server.services.search.expression.solr.SolrSearchIndexNameValidator invoke(SelectionCriteria) Core name: MC_10001_CatalogEntry_en_US
Resolving the problem
There may be several reasons why the wrong language is in the context. Further debugging into when the language is set in session will reveal where the problem lies.
A workaround is to hard code the language either in PreProcessOrderCmdImpl or in the wc-search.xml.
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.