Tuesday, March 31, 2015

Solr PreProcessing Error | SYS_C00151674 | Debugging

com.ibm.commerce.foundation.dataimport.preprocess.CatalogHierarchyDataPreProcessor determineCatalogEntriesForCatalog(Connection connection, String catalogID)
INFO: The catalog with ID: 10051 contains 174468 catalog entries.
 com.ibm.commerce.foundation.dataimport.preprocess.DataImportPreProcessorMain processDataConfig(DataProcessingConfig, String)
INFO: ORA-00001: unique constraint (SYS_C00151674) violated


If any of these 2 queries finds rows, that would be a good pointer and backup deletes and run the delete's and try again.

Rule 1: In Master catalog, you should always have 1 catalog entry belong to 1 master catalog category and CMC and dataload enforces that but if the data is loaded through another channel, this could happen.

1) To identify if there is a catalog entry that has more than one parent category, run the following SQL query against the database:
select catentry_id, catgroup_id from catgpenrel where catentry_id in (select catentry_id from catgpenrel where catalog_id = group by catentry_id having count(catentry_id) > 1)
where is the catalog ID value for which di-preprocess is being run.

The above query will provide a list of catalog entry IDs and the categories that they are mapped to if they are mapped to more than one category in the master catalog ID.
 e.g.
select catentry_id, catgroup_id from catgpenrel
where catentry_id in (select catentry_id from catgpenrel where catalog_id = 10051 group by catentry_id having count(catentry_id) > 1);

Rule 2: You should have always 1 parent category for each master catalog category.
2) To identify if the issue is caused by a category having multiple parent categories in the master catalog, run the following SQL query against the database:
select catgroup_id_parent, catgroup_id_child from catgrprel where catalog_id = and catgroup_id_child in (select catgroup_id_child from catgrprel where catalog_id = group by catgroup_id_child having count(catgroup_id_child) > 1)
e.g.
select catgroup_id_parent, catgroup_id_child from catgrprel where catalog_id = 10051 and
catgroup_id_child in (select catgroup_id_child from catgrprel where catalog_id = 10051
group by catgroup_id_child having count(catgroup_id_child) > 1);

More Logging: Edit the logging.properties file:

    Runtime location: WC_installdir/instances/ instance_name/xml/config/dataimport/logging.properties
    Toolkit location: WCDE_INT70\workspace\WC\xml\config\dataimport\logging.properties
    Verify that .level=FINEST and java.util.logging.FileHandler.level=FINEST
    Verify that java.util.logging.FileHandler.limit=80000000
    Verify that java.util.logging.FileHandler.count=10 

Wednesday, March 4, 2015

Solr Build index fails | would not provide error information | run solr direct

Last I encountered an error where running build-index from toolkit would give the following 2 lines but it wouldn't rebuild index and do nothing.
The program exiting with exit code: 0.
Data import process completed successfully with no errors.


If you need to directly run index on SOLR server: This is the command
http://localhost/solr/MC_10051_CatalogEntry_en_US/dataimport?command=full-import

To Monitor:
http://localhost/solr/MC_10051_CatalogEntry_en_US/dataimport?command=status

Once I ran directly on SOLR, full-import, it gave the errors.
In this particular case, it gave heap error and had to increase 512 MB to 1024 MB in WAS admin console.

Sunday, March 1, 2015

IBM CMC | Approved Content error on read-only mode | Working on Approved content selection

When trying to edit content in CMC, the default mode is read-only and it requires clicking the gear icon on the menu to work on Approved content. Find below screenshots, below click




Thursday, January 8, 2015

Finally Enabling multiple logon for the same user | Available from Fix pack 9


This was something that was not available for a long time but with the new fix pack. This is available. I might have an old blog where i had mentioned, it was not available in the previous versions.

Many WebSphere Commerce websites are using REST services to serve both mobile and desktop pages then it's important to allow multiple logon for the same user from different channels in a simple way. To activate this feature a specific tag should be added to the wc-server.xml in the SessionManagement section

<allowmultiplelogonforsameuser display="false" enabled="true"></allowmultiplelogonforsameuser>

Tuesday, January 6, 2015

Performance Improvements StringBuilder and ArrayList and HashMap

Use StringBuilder if Synchronization is not required.

I have used StringBuffer when performing concatenations on string and is far better than using Immutable Strings in Java but if you don't need the synchronization, which most likely could be the case so use StringBuilder

Quote from StringBuilder API:
This class [StringBuilder] provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.

Using ArrayList vs LinkedList

LinkedList is great when you don't know the size of the list as it helps.

The default initial capacity of an ArrayList is pretty small (10 from Java 1.4 - 1.7).
But since the underlying implementation is an array, the array must be re-sized if you add a lot of elements.
To avoid the high cost of resizing when you know you're going to add a lot of elements, construct the ArrayList with a higher initial capacity. What's important is to initialize the list when you know upfront the size of the ArrayList and if it is going to be more than 10

List catalogDataVOList = new ArrayList<CatalogDataVO>((int) resultCount);

Reference: http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist

Use HashMap vs Hashtable:
If Synchronization is not required use HashMap, Hashtable is a syncrhonized version and typically non synchronized objects perform better.

Wednesday, November 19, 2014

Tuning cache size and disk offload and disk cache size | Dynacache

Default cache size is 2000 and for production environments, it should be tuned to 10000 and this value would work in most cases.

It is a good idea to check enable disk offload in production environment. As the cache size exceeds the limit, it would offload to disk
Also make sure the disk in production environment has space allocated for this disk offload and 10 GB for production environment would be a good range in production. Make sure this setting is replicated on all application servers.



Tuesday, November 18, 2014

JVM Settings | Tuning heap size


It is very important to tune heap size with correct values in production.
Default values are minimum 256 MB and maximum heap size of 1024 MB.  For production environments the values are ideally around minimum heap size 4GB (4096m) and max heap size 6GB(6144m)
e.g.
java -Xmx6144m -Xms4096m

Application Server
In the Administration Console select Servers
Expand Server Type and select WebSphere application servers
Click on the name of your server
Expand Java and Process Management and select Process Definition