Friday, March 20, 2015

OrderTrashCan Feature in IBM WCS

Deleting order items and requisition lists
When a user deletes an order item or requisition list item the table rows representing those items are removed from the database. If enabled, these rows are updated to belong to the trashcan. You can clear the trashcan by running the OrderTrashCanClear scheduled job which will delete the rows, or by using the Database Clean up utility. This feature is disabled by default.

It is highly recommended that you clean your database of order items both before you enable the OrderTrashCan feature, and periodically afterwards. Order item deletion is a common operation, and as a result, a large number of deleted order items can build up in the ORDERITEMS table.

1. Open wc-sever.xml configuration file
2. Within the file, the text can be put next to "ExpectedInventorySynchronize" element.


TrashCanRequisitionListSegmentLen="30"
TrashCanOrderItemSegmentLen="50"
TrashCanEnabled="true"/>

This setting deletes order item entries from the ORDERITEMS table. If TrashCanEnabled is set to "true", when a user deletes an order item or requisition list item, the table rows representing those items are not deleted from the database. Instead, the items are updated to belong to the trashcan.

Enabling Order Trashcan feature

In wc-server.xml change the value of TrashcanEnabled="true"

Asset managment in IBM WCS

Asset managment in IBM WCS

Managed assets are files that are uploaded by business users to be used for store marketing or product supplements. They are added to Asset tool or the marketing tool in MC.

1. Managed assets, when uploaded through MC, are first stored in CMFILE, CMSMALLFILE and CMLARGEFILE tables of WCS DB.

2. From there, the scheduled job "ScheduledContentManagedFileEARUpdateCmd" evaluates its set of criteria in the WCS configuration file (wc-server.xml). The criteria and their default values are :-

minNumOfFilesForUpdate - the minimum number of files for an update to occur.
minSecFromLastUpload - The minimum number of seconds since the last update.

3. The files are extracted from DB and placed into the EAR of the staging environment.

4. These assets are then pushed to the production environments with the fileprop utility when when stagingprop called. 

Tuesday, March 17, 2015

Invalidating Cache: Data Cache Invalidation

Since Data Cache invalidation is self managed, We should not need to understand the underlying structure, but you may be curious about how Data Cache manages invalidations, or require additional information about this for your site tuning.


Data Cache invalidation IDs format in CACHEIVL

The Data cache dependency IDs are based upon which table is being cached, and what type of operation is performed to create this data. CACHEIVL entries are created by database triggers, and some Commerce processes, like Marketing or Solr. By default, CACHEIVL rows are created with a DATAID column value in this format:

WCx+TableName+colName1+colName2:%:colVal1:%:colVal2

Where x represents the type of operation that was performed, and the colName/colValue information is the unique index information about the record that was updated, so that the data cache can target the cache invalidation.  An example DATAID column value could be WCT+CATENTRY+CATENTRY_ID:%:10501, which would signify that the CATENTRY table row with CATENTRY_ID 10501 was updated, but we are not sure what operation took place.  The other operation symbols that can be used here are 'D' for deletes, or 'N' for a non-delete operation.

Monday, March 16, 2015

Message Key: _ERR_INVALID_COOKIE

Message Key: _ERR_INVALID_COOKIE


Issue : RequestedSessionIdFromURL,boolean bSingleSignOn) CMN1039E: An invalid cookie was received for the user, your logonId may be in use by another user.
[3/16/15 10:47:41:815 GMT] 000000a3 SystemOut     O ErrorDataBean:
Originating command:
Message Type: 1
Message Key: _ERR_INVALID_COOKIE
Message: CMN3101E The system is unavailable due to "{0}".


Resolution : When using Firefox or Safari browser, and a guest session
expired. Customer will see Generic System Error page 

Open : Stores\WebContent\GenericSystemError.jsp

Search for key : _ERR_INVALID_COOKIE

try {
      ErrorDataBean errorBean = new ErrorDataBean ();
      com.ibm.commerce.beans.DataBeanManager.activate (errorBean, request);
      if (errorBean.getMessageKey().equals("_ERR_INVALID_COOKIE"))
      {
                  Cookie cookies [] = request.getCookies ();
                  Cookie myCookie = null;
                  if (cookies != null){
                  System.out.println ("Cookies Issue");
                        for (int i = 0; i < cookies.length; i++) {
                              if (cookies [i].getName().equals ("WC_USERACTIVITY")) {
                                    myCookie = cookies[i];
                                    break;
                              }
                        }
                  }
                  if (myCookie != null)
                  {
                  System.out.println ("Cookies Issue -Here");
                        myCookie.setMaxAge(0);
                        myCookie.setValue("");
                        response.addCookie(myCookie);
                  }
String fwhostName = "http://" + request.getHeader("host")
 // To resolve append with below syntax (or) Redirect to home page
+"/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=12556&catalogId=33057";
            response.sendRedirect(fwhostName);
      }
      System.out.println ("ErrorDataBean:\n" + errorBean.toString()+"\n");
%>




Friday, March 13, 2015

Websphere MQ with IBM WCS

  1. Run setup.exe to install MQ
  2. In the Field for the Queue Manager name – Type in QM_{$Computer_Name}
    ** This can also be any significant name
    To get Compute Name – Goto Start -> My Computer -> Right Click - > Properties -> Tab to Computer Name

    Do NOT Join the Queue Manager to the Default Cluster.


  3. Once installed, To Test if the listener is running.

    Start -> run -> cmd

    > netstat -an | find "1414"
      TCP    0.0.0.0:1414           0.0.0.0:0              LISTENING

Configuring WebSphere MQ for use with WebSphere Commerce :


Once the Queue Manager has been created.  Queues also need to be added.
Right Click on Queues - > Create New
Created a queue for each of the following

Queue
Description
hostname.error
Default error queue. Collects erratic inbound messages.
hostname.inbound
Used by SendReceiveImmediate mode of the adapter for WebSphere MQ. It is where the reply and response messages from the backend system should go. WebSphere Commerce can optionally pick reply and response messages based on an outgoing request to a backend system.
hostname.inboundp
Any message arrive at this queue will be processed in parallel manner.
hostname.inbounds
Any message arrive at this queue will be processed in serial manner based on the message delivery sequence option of the queue.
hostname.outbound
Used for WebSphere Commerce initiated outbound messages and reply messages from WebSphere Commerce.






Add the Environment Variables
Start -> My Computer -> Right Click -> Advanced -> Environment Variables ->
MQSERVER
CLIENT.QM_<Hostname>


 Configuring WebSphere Application Server for use with WebSphere MQ

  1. Start the default WebSphere Application Server application server (server1).
D:\IBM\WCDE_ENT70_Comet\bin>startWCServer.bat
  1. Open the WebSphere Application Server Administrative Console.
http://localhost:9060/ibm/console
  1. Log on to the WebSphere Application Server Administrative Console.
wasadmin
  1. In the navigation tree, expand Environment and select WebSphere Variables. Enter the MQ_INSTALL_ROOT value:
 Click MQ_INSTALL_ROOT.



Value

C:\IBM\WebSphereMQ (OR) ${C:\Program Files (x86)\IBM\WebSphere MQ
(path in which websphere MQ is installed)

This changes mostly stored at : Document cells/localhost/nodes/localhost/variables.xml is modified.
5. Click OK.
6. Click Save in the Administrative Console task bar.
7. On the Save page, select Synchronize changes with node.
8. On the Save page, click Save.
9. Close the WebSphere Application Server Administrative Console.

Setting Native Lib Paths

Open the WebSphere Application Server Administrative Console. Log on to the WebSphere Application Server Administrative Console. Enable the ActivitySession service.
Expand Servers > Server Types. Click WebSphere Application Servers.
Click server1.
Under Container Settings, expand Business Process Services.
Click the ActivitySession service.
Select Enable service at server startup.
Click OK and save the configuration.

Click on Resourses - > JMS -> JMS Providers
And set the java lib path in native lib paths area
For Eg. (C:\Program Files (x86)\ibm\WebSphere MQ\java\lib64)

Determining the maximum number of connections allowed for the Adapter for WebSphere MQ

In the WebSphere Application Server Administrative Console navigation tree, expand Applications > Application Types and select WebSphere enterprise applications.
In the list of enterprise applications, click WC
Under Modules, click Manage Modules.
In the list of connector modules, click Adapter for WebSphere MQ. The Enablement-JCAJMSConnector.rar page displays. 
In the Additional Properties section on the Enablement-JCAJMSConnector.rar page, click Resource Adapter. The WC.Adapter for WebSphere MQ page displays,
In the Additional Properties section of the WC.Adapter for WebSphere MQ page, click J2C Connection Factories. The J2C Connection Factories page displays.
In the list of J2C Connection Factories, click Enablement-JCAJMSConnector.rar. The Enablement-JCAJMSConnector.rar page displays.
In the Additional Properties section on the javax.resource.cci.ConnectionFactory page, click Connection Pool Properties. The Connection Pools page displays.
Enterprise Applications > WC > Manage Modules > Enablement-JCAJMSConnector.rar > WC.Adapter for WebSphere MQ > J2C connection factories > javax.resource.cci.ConnectionFactory > Connection pools

Take note of the value in the Max connections field. This value will be required in Creating a WebSphere MQ messaging provider queue connection factory.
Max Connections: 10

Creating a WebSphere MQ messaging provider queue connection factory


1. In the WebSphere Application Server Administrative Console navigation tree, expand Resources and select JMS then Queue connection factories.
2. Select the scope of the queue connection factory from the list. It is recommended to create it under the scope of Node=WC_instance name_node, Server=server1 level.
3. Click New.
4. Select WebSphere MQ messaging provider and click OK


Configure basic attributes with the following values:
In the WebSphere Application Server Administrative Console navigation tree, expand Resources and select JMS then Queue connection factories.
Click New. 
Select WebSphere MQ messaging provider and click OK. 
Configure basic attributes with the following values:


Option
Description
       Name
       JMSQueueConnectionFactory
       JNDI Name                                             
       JMSQueueConnectionFactory
      Optional: Description
       JMSQueueConnectionFactory

Click Next
Enter the Queue Manager Name as appears in MQ Messaging

Click Next
In Enter Connection Details -> Select Bindings
Test Connection -> Summary -> Finished.


In the WebSphere Application Server Administrative Console navigation tree, expand Resources and select JMS then Queues

JMS queue to WebSphere MQ queue mappings



JMS queue
   WebSphere MQ queue
Target Client
      JMSSerialInboundQueue
      hostname.inbounds
        JMS
     JMSParallelInboundQueue
     hostname.inboundp
        JMS
     JMSInboundQueue
     hostname.inbound
        JMS
     JMSOutboundQueue
     hostname.outbound
        MQ
     JMSErrorQueue
     hostname.error
       MQ


Configuring WebSphere Commerce to use WebSphere MQ


In Info Center there is a step
To do this in Developer update the wc-server.xml
c:\IBM\WCDE_ENT70_Comet\workspace\WC\xml\config\ wc-server.xml

   <component
      compClassName="com.ibm.commerce.messaging.listener.TransportAdapter"
      enable="true" name="Listener for WebSphere MQ (TransportAdapter)">
      <property display="false">
        <tmpInboundConnectorFile filename="some transport xml file name - temporary"/>
      </property>
    </component>


Once this is updated, restart the server.


Testing WebSphere MQ configuration

To test your WebSphere MQ configuration, insert the following message in the hostname.inbounds message queue
Procedure
Open the WebSphere MQ Explorer according the instructions in the WebSphere MQ documentation.
Right-click hostname.inbounds and select Put Test Message from the pop-up menu.
In the test message window, enter the following text: <?xml test message> .
WebSphere MQ is configured properly if the following occurs:
The test message is consumed from the serial inbound queue (hostname.inbounds).
An error message appears in the hostname.outbound queue.
The original message appears in the hostname.error queue.