Wednesday, November 23, 2016

WebSphere Commerce database query and caching

WebSphere Commerce database query and caching

 

 

In WCS, querying database can be cached on WC application and Search application, with slightly different settings.

 

Reference: http://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.admin.doc/concepts/cdcaddcomdatcacheconfig.htm

 

WCS database query:

1.      Create new query template file, .tpl

http://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.developer.soa.doc/concepts/csdqtf.htm

Create your new extended configuration directory, if not exists. For example,

xml\config\com.ibm.commerce.catalog-ext

Create a new tpl file, with wc-query- as name prefix.

In the body, create SQL in below format:

BEGIN_SQL_STATEMENT

name=SELECT_MY_TABLE

base_table=XMYTABLE

sql=SELECT COLUMN1,COLUMN2 FROM XMAYTABLE WHERE XMAYTABLE_ID = ?MAYTABLE_ID?

END_SQL_STATEMENT

2.      In your Java application, use JDBCQueryService to execute it, like this:

Map sqlParams= new HashMap();

sqlParams.put("MAYTABLE_ID", Collections.singletonList(getMyTableId()));

 

List<Map> nameValueDataSet =   new JDBCQueryService("com.ibm.commerce.catalog").executeQuery("SELECT_MY_TABLE", sqlParams);

 if(nameValueDataSet != null && !nameValueDataSet.isEmpty())

            {

                for(Map rowMap : nameValueDataSet)

                {

                      String column1Value= (String)rowMap.get("COLUMN1");

String column2Value= (String)rowMap.get("COLUMN2");

                     …

                }

            }

 

3.      Caching:

o   In WC application (Fix pack 9)

In order to cache this query, in wc-server.xml, locate "CrossTransactionCache" element

Add or update below attributes:

maxTimeToLiveForAutoCacheEntries="172800"

autoCacheableTableNames="XMAYTABLE XMAYTABLE2 XMAYTABLE3"

 

Make sure the value in cacheableTableNames are using space/tab/new line as delimiter.

maxTimeToLiveForAutoCacheEntries value cannot be 0, otherwise, it will not be cached.

 

o   In Search application (FEP7)

http://www.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.developer.doc/concepts/csdwccomponentxml_fep7.htm

Create or update the wc-component.xml in extended directory, such as:

Search_eardir/xml/config/com.ibm.commerce.foundation-ext/wc-component.xml

 

Locate "CrossTransactionCache" XML element, append your customized table name into

"autoCacheableTableNames" attribute.  For example:

            

<_config:extendedconfiguration>

<_config:configgrouping name="CrossTransactionCache">        

 <_config:property name="CrossTransactionCache/autoCacheableTableNames" value="SRCHCONF SRCHCONFEXT SRCHATTRPROP SRCHATTR STORECAT STOREDEFCAT CATALOG XMYTABLE1 XMYTABLE2"/>

        </_config:configgrouping>

</_config:extendedconfiguration>

 

 

Monday, December 01, 2014

How to refresh the java.util.ResourceBundle in runtime

Invoking a JSP which includes this code:

<%

  Java.util.ResourceBundle.clearCache(Thread.currentThread().getContextClassLoader());

%>

Thursday, October 02, 2014

WCS V7 FEP7: Adding additional filed into WCS REST search result

Objective:

Through following steps, we will:

a.      Use WCS search preprocess to create additional temporary tables to hold the flatten attributes.

b.      Update Solr schema to support new fields

c.      Update DIH configuration SQL to fetch new data from temporary table.

d.      Extended search profile to allow new Solr fields to be in Solr search result

e.      Update jsp to use new search profile.

 

Procedure:

2.      Configuration in search preprocess:

Add new configuration file in directory: WC_installdir /instances/ instance_name /search\pre-processConfig/MC_ masterCatalogId / databaseType,

For example: search/MC_10001\DB2

a.      Name: wc-dataimport-preprocess-<your own name>.xml; keep the prefix as “wc-dataimport-preprocess”.  (A little trick is that you can name your own file name starting with “a”, for example, wc-dataimport-preprocess-a-mynewdata-attribute.xml ,so the pre-process shell script will run it first by alphabetical order, this will help in development time to verify the testing result without waiting for the whole process completes.)

b.      Add query configuration to populate temporary database table for data import

c.      Follow the instruction to run di-preprocess utility, exam the new temporary table and its data content.

 

Structure of data-processing-config element:

   

<_config:data-processing-config processor="com.ibm.commerce.foundation.dataimport.preprocess.StaticAttributeDataPreProcessor" masterCatalogId="10001" fetchSize="500" batchSize="500">

 

 

 

 

 

 

               <_config:table definition="CREATE TABLE TI_MY_TABLE_#lang_tag# (CATENTRY_ID BIGINT NOT NULL, NEWDATA VARCHAR(256) ,PRIMARY KEY (CATENTRY_ID))" name=" TI_MY_TABLE_#lang_tag#"/>

 

               <_config:query sql="SELECT NEWCOLUMN AS NEWDATA, CATENTRY_ID FROM MY_OWN_TABLE"/>

 

 

 

               <_config:mapping>

                 <_config:key queryColumn="CATENTRY_ID" tableColumn="CATENTRY_ID"/>

                 <_config:column-mapping>

                       <_config:column-column-mapping>                            

                              <_config:column-column queryColumn="NEWDATA" tableColumn="NEWDATA"/>

                       </_config:column-column-mapping>

                       </_config:column-mapping>

               </_config:mapping>          

  </_config:data-processing-config>

For the simple table creation, the StaticAttributeDataPreProcessor is enough. It will translate your “language_id” and #lang_tag# parameters.

If you need more control on the table creation, create your own PreProcessor by extending AbstractDataPreProcessor

 

 

Create your table definition with dynamic language tag.

It will be translated into the actual langId. The negative sign will be trimmed off.

 

The simplified query to select the dataset. The resuleset data will be inserted into above table.

 

 

Map the primary key column names.

 

 

Map the returned SELECT resultset column name to temporary table column names.  It is better to keep them the same.

 

 

              

 

 

2.      Adding new Solr fields into Solr schema

(You can learn the details in Apache Solr about this)

Update schema.xml in each Solr core, for example: \solr\home\MC_10001\en_US\CatalogEntry\conf\schema.xml

Add below:

<field name="newField" type="string" indexed="true" stored="true" multiValued="true"/>

Where:

           Type- depends on your search needs, you may need use different data type for this. For example, you need consider whether this should be tokenized, case sensitive, etc. You can follow WCS naming convention.

           Indexed – only indexed field can be searchable in Solr. If you don’t need the newField to be searchable, as it maybe just some additional descriptive field, set it to false.

           Stored – if true, you can retrieve its value through Solr request. You cann’t see its value if you set it false. It could become useful when you only want user to search by it, but show other fields instead other than showing this field.

           multivalued – whether you want to set this value as an array type to hold multiple values.

If you want this newField being part of your default search field, do this :

<copyField source="newField" dest="defaultSearch"/>

 

3.      DIH (dataimport handler) configuration

(You can learn the details in Apache Solr about this)

Update wc-data-config.xml in  \solr\home\MC_10001\en_US\CatalogEntry\conf

a.      Update query  to join the new temporary table

·        Add additional line in SELECT clause to return the newData

TI_MY_TABLE.NEWDATA as MY_NEWDATA

 

·        Add left outer join line in FROM clause (use alias name without langId)

LEFT OUTER JOIN TI_MY_TABLE_1 TI_MY_TABLE ON ( CATENTRY.CATENTRY_ID= TI_MY_TABLE.CATENTRY_ID)

 

b.      Add below:

<field  column="MY_NEWDATA" name="newData"/>        

 

If it is multi value Solr field, you have to create the data with separator, like “;”. Then use splitBy to split it.

For example:

           <field  sourceColName="MY_NEWDATA" column="newData" splitBy=";"/>        

 

Note1: in case of <field  column="MY_NEWDATA" name="newData"/>, “column” is database column name.

             In <field  sourceColName="MY_NEWDATA" column="newData" splitBy=";"/>   , “column” is schema field name. ( A design naming convention needs to be revised by Solr.)

 

Note2: if you use splitBy, better to use different sourceColName and column names. Or same name in case sensitive format.

           The format of <field  sourceColName="NEWDATA" column="newData" splitBy=";"/>     will have issue in the final result. The unsplit data will be shown.

 

c.      Repeat above steps for other cores.

 

4.      Create a new search profileMy_own_search_profile”

a.      In wc-search.xml at Search\xml\config\com.ibm.commerce.catalog-ext,

if you donot have “-ext” directory, you need create one. Copy the header part from existing wc-search.xml.

 

add below, assuming this will extends IBM_findProductByIds_Summary:

<_config:profile extends="IBM_findProductByIds_Summary" name=" My_own_search_profile ">

        <_config:result inherits="true" >

            <_config:field name="newData"/>

        </_config:result>

    </_config:profile>

 

 

 

5.      Update JSP

a.      In JSP file, set the above new search profile to WCF:REST request.  

 

 

6.      Search server setup.

In order to allow WCS Search server to accept new search profile, you need add the new search file into the Search-Rest configuration.

Add new profiles My_own_search_profile in searchProfile list of wc-rest-resourceconfig.xml in Search-Rest\WebContent\WEB-INF\config\com.ibm.commerce.rest-ext

    If you donot have –ext, create one, and copy wc-rest-resourceconfig.xml from com.ibm.commerce.rest directory .

Assuming you are using path “store/{storeId}/productview/byIds”:

<GetUri uri="store/{storeId}/productview/byIds"

description="Get products by unique IDs"

searchProfile=" My_own_search_profile,<existing list…..>”

 

This will allow search server to accept new searchProfile.

 

 

 

 

Sunday, February 23, 2014

Hybris HCM error

Experiencing below exception while playing with customized hMC.
Turned out I didn't update all the return value of my customized HMCExtension class correctly.



Most of methods, I should return "Collections.EMPTY_LIST;" rather "null" value.

sample of correct settings:

public List getToolbarActionChips(final DisplayState displayState, final Chip parent)
    {
        return Collections.EMPTY_LIST;
        return null;

    }






-------------------------------------
Exception log shows below:
-------------------------------------


ERROR [hybrisHTTP1] [ChipFactory] ============================================
ERROR [hybrisHTTP1] [ChipFactory] ChipFactory.getInstance(...) Exception (class java.lang.NullPointerException)
ERROR [hybrisHTTP1] [ChipFactory]       CoreClass:              class de.hybris.platform.hmc.ToolbarChip
ERROR [hybrisHTTP1] [ChipFactory]       CustomClass:            null
ERROR [hybrisHTTP1] [ChipFactory]       ParameterClasses                |               ParameterValues
ERROR [hybrisHTTP1] [ChipFactory]               0. Class: class de.hybris.platform.hmc.webchips.DisplayState
ERROR [hybrisHTTP1] [ChipFactory]               0. Value: de.hybris.platform.hmc.webchips.DisplayState@3732ed7c
ERROR [hybrisHTTP1] [ChipFactory]               1. Class: interface de.hybris.platform.hmc.webchips.Chip
ERROR [hybrisHTTP1] [ChipFactory]               1. Value: de.hybris.platform.hmc.ExplorerChip@70858433
ERROR [hybrisHTTP1] [ChipFactory] Stacktrace
java.lang.NullPointerException
        at de.hybris.platform.hmc.extension.SlotManager.getToolbarActionChips(SlotManager.java:331)
        at de.hybris.platform.hmc.AbstractToolbarChip.initialize(AbstractToolbarChip.java:298)
        at de.hybris.platform.hmc.ToolbarChip.(ToolbarChip.java:38)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at de.hybris.platform.hmc.ChipFactory.getInstance(ChipFactory.java:71)
        at de.hybris.platform.hmc.ChipFactory.getInstance(ChipFactory.java:135)
        at de.hybris.platform.hmc.ExplorerChip.(ExplorerChip.java:136)
        at de.hybris.platform.hmc.MainChip.openExplorer(MainChip.java:230)
        at de.hybris.platform.hmc.MainChip.processEvents(MainChip.java:149)
        at de.hybris.platform.hmc.webchips.DisplayState.dispatchEvents(DisplayState.java:638)
        at de.hybris.platform.hmc.webchips.DisplayState.extractEventsFromParameters(DisplayState.java:438)
        at de.hybris.platform.hmc.webchips.DisplayState.processEvents(DisplayState.java:354)
        at de.hybris.platform.hmc.webchips.MasterServlet.process(MasterServlet.java:193)
        at de.hybris.platform.hmc.webchips.MasterServlet.doPost(MasterServlet.java:83)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

Thursday, December 12, 2013

Hybris backoffice error


java.lang.NullPointerException
        at com.hybris.backoffice.cockpitng.modules.BackofficeModuleConnector.getWidgetTreeContent(BackofficeModuleConnector.java:90)
        at com.hybris.cockpitng.modules.persistence.impl.XmlModuleAwarePersistenceService.loadWidgets(XmlModuleAwarePersistenceService.java:135)
        at com.hybris.cockpitng.core.persistence.impl.XMLWidgetPersistenceService.loadWidgetTree(XMLWidgetPersistenceService.java:95)
        at com.hybris.cockpitng.core.persistence.impl.XMLWidgetPersistenceService.loadWidgetTree(XMLWidgetPersistenceService.java:84)
        at com.hybris.cockpitng.engine.impl.DefaultCockpitWidgetEngine.resolveWidgetInstance(DefaultCockpitWidgetEngine.java:212)
        at com.hybris.cockpitng.engine.impl.DefaultCockpitWidgetEngine.createWidgetView(DefaultCockpitWidgetEngine.java:150)
       at com.hybris.cockpitng.engine.impl.AdminmodeWidgetEngine.createWidgetView(AdminmodeWidgetEngine.java:95)
        at com.hybris.cockpitng.components.Widgetslot.updateView(Widgetslot.java:73)


After create new backoffic extension, and login to the http://localhost:9001/backoffice/. The above error occurred.

Run ant clean all again, it seems some of the newly generated code not being deployed to the server.
  

Tuesday, March 29, 2011

WCS 7 Developer Installation and Migration Guide


** Notes: Run these installations as Admin user.
For details of installation and migration, follow WebSphere Commerce V75 Info Center, section of “Installing and upgrading”, http://publib.boulder.ibm.com/infocenter/radhelp/v7r5/index.jsp.
1. Installation
The installation paths used in this sample:
RAD75 D:\RAD75\SDP
WAS7 D:\RAD75\SDP\runtimes\base_v7
WCS developer: D:\WCDE70
DB2 D:\IBM\SQLLIB
IBM Installation Manager: D:\IBM\InstallationManager
1.1 Install IBM Installation Manager and RAD7.5
At RAD7.5 installation setup package, by using the launchpad program, IBM Installation Manager automatically starts even if it is not already installed.
You will then install Installation Manager on your computer during the process of installing Rational Application Developer.
* Follow carefully on this page for the details of installation : Installing Rational Application Developer or Rational Software Architect, http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.install.doc/tasks/tiginstallrad.htm
1.2 Follow the instructions to apply fixes to WAS70 and RAD75.
1.3 Install WebSphere Commerce toolkit
1.4 Install WCS feature pack
Follow this link :
1.5 Install database DB2 V9.7
See details from DB2 V9 documentation.
This should be fairly simple installation, just follow the instructions of the installer.
2. Backup
Backup the installed WCS toolkit files, in case of later steps fail.
3. Restore Database from 561
Run database backup from existing database. (Use name MALL for example)
> db2 backup db MALL
Copy the file over to the target (this workstation) location.
Run database restore
> db2 restore db MALL
4. Prepare migration
4.1 Export extension logic jar
Export existing extension logic jar.
4.2 Export extension data jar
Export existing extension data jar as EJB jar.
4.3 Export WARs
Export as JAR (not WAR).
# To export a custom Web project from WebSphere Commerce Developer Version 5.6.1, or a custom Java project from version 5.6.1 or version 6.0:
4.3.1. Open your WebSphere Commerce Developer development environment workspace and open the J2EE perspective.
4.3.2. Select the project containing your customized code. Right-click the mouse button and select Export .
4.3.3. Select Jar file and click Next .
4.3.4. In the list of resources under Select the resources to export , ensure your project is selected.
4.3.5. Ensure Export generated class files and resources and Export java source files and resources are selected.
4.3.6. Click Browse and choose a path to save the exported JAR file.
4.3.7. Ensure Compress the contents of the JAR file is checked.
4.3.8. Click Finish to complete the exporting,
# If you exported custom projects from a WebSphere Application Server Version 5.1 environment, you need to correct the paths in your compressed JAR or ZIP file. The directory path has changed from:
* Stores/Web Content/storename
to
* Stores/WebContent/storename
5. Migration from V561
These steps may be different depends on the restored database data variation.
5.1 Migration of Logic jar:
Import:
right click on WebSphereCommerceServerExtensionsLogic/src,
import,
select General/Archive file,
browse to the logic jar that was exported from WCS561 as archive jar file.
select the files that need to import. some of the files need to be excluded. (choose "com" only)
.classpath
.classpath.template
.project
.externalToolBuilders
.svn
META-INF
Check overwirte existing files without warning.
Re-import/organize the lib jars:
* Do #5.2 first to complete the data jar's migration
* Import the jars from lib/ext, and jars from WC project. (Should follow #5.2's approach to create user library of lib/ext jars, and WC jars. )
5.2 Migration of Data jar.
Import:
Delete existing WebSphereCommerceServerExtensionsData. Check "Delete project contents on disk"
select File\import\EJB\EJB JAR file
select exported jar,
make sure the EJB project name is correct.
check Add roject to an EAR, and make sure WC is selected at EAR Project Name.
Refresh EJB project.
(Update the class path for each custom project to resolve the dependencies on libraries and between projects)
Properties/buildPath/Libraries/Add Library...
select User Library, next, click UserLibraries..., click New..., enter name WCSEJBs (can be any name).
Select this library, click Add JARs, browser to wc.modules\ejbs\db2, select All (CTRL+A).
click OK, Finish.
Optimistic locking update:
To use WebSphere Commerce optimistic locking, CMP 1.x EJB entity beans must extend from the ECEntityBean class.
If the EJB entity bean class defines an ejbLoad method, that method must call super.ejbLoad.
If it defines an ejbStore method, that method must call super.ejbStore.
5.2.1. Open WebSphere Commerce Developer.
5.2.2. Optional: Validating that CMP entity beans can use optimistic locking
5.2.3. Expand the EJB Project that you want to migrate.
5.2.4. For each ejbCreate method in each class in the project:
5.2.4.1. Add this.initializeFields(); as the first line in the method.
5.2.4.2. Add this.initializeOptCounter( primaryKey); as the last line in the method before the return statement, where primaryKey is the key generated by the key class. This method must be called after the primary key is set.
The resulting method should look similar to the following example, in which memberId is the primary key:
public com.ibm.commerce.extension.objects.BonusKey ejbCreate( java.lang.Long memberId,java.lang.Integer bonusPoint)
throws javax.ejb.CreateException
{
this.initializeFields();
_initLinks();
this.memberId=memberId;
this.bonusPoint=bonusPoint;
BonusKey myNewBonusKey = new BonusKey (memberId);
this.initializeOptCounter(myNewBonusKey);
return null; }
5.2.5. Right-click the EJB Project that you want to migrate.
5.2.6. Select Migrate to WC optimistic locking.
5.2.7. When the migration is complete, click Details. A report of the files migrated displays. Check to see which files were changed, and whether any errors were found. If you need to store the migration results, you can select the results, right-click and select Copy and paste it into a text editor before clicking OK.
5.2.8. Remember to re-deploy the EJB project for the changes to take effect.
5.3 Migration WARs, use Stores for example
5.3.1. Open your WebSphere Commerce Developer Version 7.0 development environment workspace and open the Java EE perspective.
5.3.2. Select the corresponding project.
5.3.3. Right-click the target project and click Import .
5.3.4. Select the type of source that will be imported and click Next .
5.3.5. Click Browse to find the file you want to import.
5.3.6. If you are asked to overwrite any files, select Yes for each file.
5.3.7. Click Finish .
Notes:
5.3.7.1. The class path for each custom project must be updated to resolve the dependencies on libraries and between projects.
5.3.7.2. Do not import any of the meta data, or your migration will not work. Meta data includes the following files:
* .compatibility
* .j2ee
* .runtime
* .project
* .classpath
* .websettings
* META-INF/
o MANIFEST.MF
* WebContent/WEB-INF
o base.tld
o flow.tld
o struts-bean.tld
o struts-html.tld
o struts-logic.tld
o struts-nested.tld
o struts-template.tld
o struts-tiles.tld
o ibm-web-bnd.xml
o ibm-web-ext.xml
o WCEP.tld
o web.xml
o struts-config-catalog-services.xml
o struts-config-contract-services.xml
o struts-config-GiftCenter.xml
o struts-config-management-center.xml
o struts-config-marketing-services.xml
o struts-config-member-services.xml
o struts-config-order-services.xml
o struts-config.xml
o struts-wc-webservices.xml
* WebContent/META-INF/
o MANIFEST.MF
* WebContent/WEB-INF/lib
o wcbase.jar
5.3.8
# Search for the section of the web.xml file and add the following information:
*.jsp
true
For example:
flow.tld
/WEB-INF/flow.tld
*.jsp
true
# After you have migrated the JSP files, in order to get all of your store pages to work, you must do the following steps:
5.3.8.1. Navigate to the following directory on your WebSphere Commerce Version 5.6.1 or 6.0 machine:
* WCDE_installdir\properties\tools\stores\store_name
5.3.8.2. Copy the directory and paste it into the WebSphere Commerce Version 7.0 directory:
* workspace_dir\WC\properties\tools\stores\store_name
5.3.8.3. Version 5.6 Navigate to the following directory on your WebSphere Commerce Version 5.6.1 machine:
* workspace_dir\Stores\Web Content\WEB-INF\classes\store_name
5.3.8.4. Version 5.6 Copy the directory and paste it into the WebSphere Commerce Version 7.0 directory:
* workspace_dir\stores\src\store_name
5.3.8.5. Refresh your workspace.
5.4 Migrate database
Follow the instruction on info center.
If the migration wizard fails, use command line. (I have error of parsing the config.xml through wizard, below are steps for command line migration).
Assuming the restore database is completed.
These are basic steps, if you donot run into any trouble.
5.4.1.0 Go to directory WCDE_installdir\bin.
5.4.1.1 Run the updatedb2configuration.bat script.
5.4.1.2. Run the database check script by typing:
wcim_ant.bat -tier db -action check -from 561
5.4.1.3. Run the database migration script by typing:
wcim_ant.bat -tier db -action migrate -from 561
5.4.1.4. Check the wcim.server.yyyy.mm.dd_hh.mm.ss.log file in the WCDE_installdir\logs\WCIM\ directory (assuming you are using the defaults) for additional messages or errors. Resolve any errors that are flagged before proceeding. To check the log files, complete the following steps:
1. Access the log file by typing the following path:
* Windows WC_installdir\logs\WCIM\wcim.server.yyyy.mm.dd_hh.mm.ss.log
2. Review warnings generated by the database tier migration script and determine if any actions are needed based on those warnings. The actions can be found within the warning. The following list shows the type of warnings to review:
[2009.09.23.23.07.23] WARNING: [wcimBootstrapDeltaTask] The bootstrap data has changed. Consider replacing data in table cmdreg with data in cmdreg_new.
[2009.09.23.23.07.23] WARNING: [wcimBootstrapDeltaTask] The row in thecmdreg_new: storeent_id = 0, interfacename = 0, classname = com.ibm.commerce.usermanagement.commands.UserRegistrationAddCmd, properties = com.ibm.commerce.usermanagement.commands.UserRegistrationAddUBFCmdImpl
[2009.09.23.23.07.23] WARNING: [wcimBootstrapDeltaTask] The row in thecmdreg : storeent_id = 0, interfacename = 0, classname = null, properties = com.ibm.commerce.usermanagement.commands.UserRegistrationAddCmdImpl
[2009.09.23.23.07.23] WARNING: [wcimBootstrapDeltaTask] The row in thecmdreg_new: storeent_id = 0, interfacename = 0, classname = com.ibm.commerce.order.calculation.ApplyShippingCmd, properties = com.ibm.commerce.order.calculation.ApplyShippingCmdImpl
[2009.09.23.23.07.23] WARNING: [wcimBootstrapDeltaTask] The row in thecmdreg : storeent_id = 0, interfacename = 0, classname = null, properties = com.ibm.commerce.order.calculation.PromotionEngineApplyShippingCmdImpl
*** 5.4.2 In the sample database I have taken, there are issues, so these are the steps to fix:
5.4.2.1 if the process fail, check file D:\WCDE70\migration\xml\features\BASE\db\561\build.xml,
comment out those comepleted steps so the process can be resumed.
otherwise, the database needs to be restored.
5.4.2.2 Issue: there are some categories do not have association in storecgrp.
Run this to fix data issue:
insert into storecgrp select 10051,CATGROUP_ID from catgroup where catgroup_id not in (select catgroup_id from storecgrp) and catgroup_id<>0
drop trigger MY_TRIGGER;
....

--db2 -tvf D:\WCDE70\schema\migration\561\db2\wcgrm.sql
run part of wcgrm.sql:
DROP INDEX GR_index1;
DROP INDEX GR_index2;
DROP INDEX GR_index3;
DROP INDEX GrG_Constraint1;
DROP INDEX GrR_Constraint3;
--DROP INDEX GrE_Constraint3;
DROP INDEX PR_index_1;
DROP INDEX GiftItem_index2;
DROP INDEX GiftItem_uindex1;d
DROP INDEX GiftItem_index1;
DROP INDEX GrETDesc_uindex1;
DROP INDEX GrAddr_index2;
in D:\WCDE70\schema\db2\fixpack1\wcs.giftRegistry.sql comment out :
-- INDEX gr_index2
--DROP INDEX gr_index3
Log output sample:
INFO: INDEX16K=TAB16K
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/promotions/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/dd/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/jstl/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/BASE/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/config/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/struts/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/coremetrics/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/GiftCenter/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/wmm/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/dynacache/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/web-bnd/db/561/build.xml
INFO: [wcimListFeaturesTask] D:\WCDE70\migration\xml\features/commonJ/db/561/build.xml
INFO: [wcimListFeaturesTask] 'BASE','promotions','struts','GiftCenter'
INFO: [wcimCallTargetTask] feature: 'BASE'
INFO: [wcimDBVersionInfoTask] SET SCHEMA DB2ADMIN
INFO: [wcimDBVersionInfoTask] SELECT * FROM SITE
INFO: [wcimDBVersionInfoTask] Columns in the SITE table:
INFO: [wcimDBVersionInfoTask] COMPNAME=null
INFO: [wcimDBVersionInfoTask] EDITION=be
INFO: [wcimDBVersionInfoTask] VERSION=5
INFO: [wcimDBVersionInfoTask] RELEASE=6
INFO: [wcimDBVersionInfoTask] MOD=1
INFO: [wcimDBVersionInfoTask] FIXPACK=-1
INFO: [wcimDBVersionInfoTask] Properties in memory:
INFO: [wcimDBVersionInfoTask] editionKey=be
INFO: [wcimDBVersionInfoTask] ecVersionKey=5
INFO: [wcimDBVersionInfoTask] releaseKey=6
INFO: [wcimDBVersionInfoTask] modificationKey=1
INFO: [wcimDBVersionInfoTask] fixpackKey=-1
INFO: [wcimDBCheckingTask] SET SCHEMA DB2ADMIN
INFO: [wcimDBCheckingTask] select count(*) from BUSAUDIT
INFO: [wcimDBCheckingTask] select count(*) from CACHEIVL
INFO: [wcimDBCheckingTask] select count(*) from CATENCALCD
INFO: [wcimDBCheckingTask] select count(*) from CATGPCALCD
INFO: [wcimDBCheckingTask] select count(*) from EMLMSG
INFO: [wcimDBCheckingTask] select count(*) from ICMREGDESC
INFO: [wcimDBCheckingTask] select count(*) from ORDERS
INFO: [wcimDBCheckingTask] select count(*) from ORGENTITY
INFO: [wcimDBCheckingTask] select count(*) from PX_PROMOTION
INFO: [wcimDBCheckingTask] select count(*) from REFKEYS
INFO: [wcimDBCheckingTask] select count(*) from STOREENTDS
WARNING: [wcimDBCheckingTask] In order to migrate one of the biggest tables "ORDERS" in the database, the database migration script needs at least 45 MB in the database log space. Requires at least 45 MB free dis
INFO: [wcimDBCheckingTask] select count(*) from address where status='P' and selfaddress=1 and member_id=-1000 and isprimary=1
INFO: [wcimDBCheckingTask] select count(*) from address where status='P' and selfaddress=1 and member_id=-2001 and isprimary=1
INFO: [wcimDBCheckingTask] select count(*) from address where status='P' and selfaddress=1 and member_id=-2000 and isprimary=1
INFO: [wcimDBCheckingTask] select count(catgroup_id) from catgroup where catgroup_id not in (select catgroup_id from storecgrp) and catgroup_id<>0
INFO: [wcimCallTargetTask] feature: 'promotions'
INFO: [wcimCallTargetTask] feature: 'struts'
INFO: [wcimCallTargetTask] feature: 'GiftCenter'
INFO: [wcimEchoTask] Finishing ANT for WCIM at February 23 2011 12:21 PM.
INFO: WCIM has completed the job(s) successfully.
5.4.3 Customized data migration
Add OptCounter to customized tables:
ALTER TABLE table_name ADD COLUMN optcounter SMALLINT
 。。。。

create trigger.
db2 -td# -vf trigger.sql
below is the sql contents:
// ***** Starting of trigger.sql
CREATE TRIGGER perf_cma
NO CASCADE BEFORE UPDATE ON EMAILREG
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm1
NO CASCADE BEFORE UPDATE ON MOSTPOP
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm2
NO CASCADE BEFORE UPDATE ON CATREQ
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm3
NO CASCADE BEFORE UPDATE ON PHONEREG
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm4
NO CASCADE BEFORE UPDATE ON POSTREG
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm5
NO CASCADE BEFORE UPDATE ON DATAEXPORTCONF
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm6
NO CASCADE BEFORE UPDATE ON CATUPDATEERROR
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cmc
NO CASCADE BEFORE UPDATE ON CATUPDATE
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm7
NO CASCADE BEFORE UPDATE ON CATUPDATEIMAGE
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm8
NO CASCADE BEFORE UPDATE ON CATUPDATESKU
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cm9
NO CASCADE BEFORE UPDATE ON IMAGEUPDATE
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a10
NO CASCADE BEFORE UPDATE ON CATUPDATEPACKAGE
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a11
NO CASCADE BEFORE UPDATE ON HAMMERDROPSTATS
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a12
NO CASCADE BEFORE UPDATE ON HAMMERDROPEVENT
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cmo
NO CASCADE BEFORE UPDATE ON NEWMOVER
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cmp
NO CASCADE BEFORE UPDATE ON HDROPSTATSBYHOUR
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a13
NO CASCADE BEFORE UPDATE ON HDROPSTATSBYQTY
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a14
NO CASCADE BEFORE UPDATE ON PRIVPREFACTION
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a15
NO CASCADE BEFORE UPDATE ON INVSNAPSHOT
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a16
NO CASCADE BEFORE UPDATE ON CATENTEXT
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a17
NO CASCADE BEFORE UPDATE ON CPADDRLOOKUP
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a18
NO CASCADE BEFORE UPDATE ON CPSTREETREF
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_cmr
NO CASCADE BEFORE UPDATE ON CPMUNICIPALITYREF
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a19
NO CASCADE BEFORE UPDATE ON XCONTESTINFO
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a20
NO CASCADE BEFORE UPDATE ON HDTOPSELLERS
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a21
NO CASCADE BEFORE UPDATE ON PLANTTAG
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a22
NO CASCADE BEFORE UPDATE ON PLANTTAGATTR
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a23
NO CASCADE BEFORE UPDATE ON PLANTTAGATTRTXT
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a24
NO CASCADE BEFORE UPDATE ON PLANTTAGITEM
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a25
NO CASCADE BEFORE UPDATE ON WORKSHOP
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a26
NO CASCADE BEFORE UPDATE ON WORKSHOPSIGNUP
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
CREATE TRIGGER perf_a27
NO CASCADE BEFORE UPDATE ON HDSTORES
REFERENCING NEW AS NEWOPT OLD AS OLDOPT
FOR EACH ROW MODE DB2SQL
when ((NEWOPT.optcounter is null) or (OLDOPT.optcounter = NEWOPT.optcounter))
begin atomic
set NEWOPT.optcounter = case
when OLDOPT.optcounter < 32767
then
OLDOPT.optcounter + 1
else
1
end;
end#
//***** end of trigger.sql
5.4.4 Continue with manual migration script. (Wizard does not work becuase of not able to parse config.xml )
//wcim_ant.bat -tier db -action check -from 561
wcim_ant.bat -tier db -action migrate -from 561
5.5 Additional migration work
Issues:
5.5.1 object naming of Enumeration cannot be enum, as it is reversed keyword for Java1.5.
Repalce all from logic, jsps.
5.5.2 Migrating EJB will create backends folder under META-INF which creates the table names same as bean name.
This needs to be corrected.
5.5.3 Web server setup
5.5.4 Libs
Copy all library jars from Lib\ext\ over, but remove wcs.jar.