Sunday, April 17, 2011

Toolkit eclipse crash | recovery

Command-line arguments: -plugincustomization C:\RAD601\eclipse\default\plugin_customization.ini -showlocation

!ENTRY org.eclipse.osgi Apr 17, 2011 21:50:00.278
!MESSAGE An error occured while automatically activating bundle
org.eclipse.core.resources (262).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.core.internal.compatibility.PluginActivator.start() of bundle org.eclipse.core.resources.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator
(BundleContextImpl.java:975) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start
(BundleContextImpl.java:937)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker
(BundleHost.java:421)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start
(AbstractBundle.java:293) at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass
(EclipseClassLoader.java:110)

If you experience the above problem, it is because of either your windows got restarted without closing the eclipse properly or if you are using ant and there is a resource blocked by another program or sometimes just random.

Recovery:

1. Deleting those two files in workspace metadata folder
\.metadata\.plugins\org.eclipse.core.resources\.snap
\.metadata\.plugins\org.eclipse.core.resources\.root\.markers.snap

2. Once you delete those files and stat toolkit, you will see all the projects would disappear from workspace. Delete wasprofile directory under and
Run setup.bat from TOOLKIT_HOME\bin

3. Make sure your DB is pointed to right DB. Start server and publish.

4. Get all the latest files from SVN\CVS if you have a build script just run that.

Friday, April 1, 2011

Contract Locking Issue | Delete corrupt entries from CMMETADATA

    Run the following SQL statement:

    select * from cmmetadata where member_id = 4666666666666660075

    delete these records.from the results of the above statement.

    com.ibm.commerce.contract.util.ContractTCLockHelper managingLock Entry
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT > com.ibm.commerce.contract.util.ContractTCLockHelper lockIfNoExistingLock Entry
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT 3 com.ibm.commerce.contract.util.ContractTCLockHelper lockIfNoExistingLock Lock is found for contractId=3555555555555568075 TCType=1349592408, lock=com.ibm.commerce.context.content.locking.LockData [action = U | memberId = 4666666666666660075 | workspace = null | taskgroup = null | task = null | locking policy = com.ibm.commerce.context.content.locking.SingleUserLockingPolicy@bccda3a]
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT < com.ibm.commerce.contract.util.ContractTCLockHelper lockIfNoExistingLock Exit
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT > com.ibm.commerce.contract.util.ContractTCLockHelper renewLockIfUserIsLockOwner Entry
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT 3 com.ibm.commerce.contract.util.ContractTCLockHelper renewLockIfUserIsLockOwner Lock owner is different from the requestor ID for contractId=3555555555555568075 TCType=1349592408
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT < com.ibm.commerce.contract.util.ContractTCLockHelper renewLockIfUserIsLockOwner Exit
    [5/27/10 14:18:14:925 PDT] 00000035 WC_CONTRACT > com.ibm.commerce.contract.util.ContractTCLockHelper checkLockOwnerLastLogonTime Entry

Tuesday, March 1, 2011

WCParam versus Request/Response Properties merge mystery!

This is a really interesting one, After moving from 6.0.0.7 to 6.0.0.10. Most of the views started failing in the front end and started throwing null pointer exceptions.

General assumption WCParam=requestProperties+responseProperties

IBM post 6.0.0.9 by default refrain from merging request properties and response properties into WCParam and hence the request properties were correctly reflected in WCParam but the response properties were not available.

Inside the Instance Tag in wc-server.xml there is a new parameter added WCParamMode
Add the parameter if this is not available and update the value to
WCParamMode="1".


Wednesday, February 23, 2011

Price OverRide feature for price drop

Out of the box the price override feature is used in the Sales center to override the price by an admin.

This feature is really easy to customize for requirements such as price drop , to show some discount and implement as a price override. There is a bit for price override that needs to be set to let the performance engine make aware there is a price override on a orderitem.

int currentPrepFlag =orderItems[i].getPrepareFlagsInEJBType().intValue();
currentPrepFlag |=OrderConstants.PREPAREFLAGS_PRICE_OVERRIDE;
orderItems[i].setPrice(String.valueOf(finalprice));
orderItems[i].setPrepareFlags(new Integer(currentPrepFlag ));
orderItems[i].commitCopyHelper();

Tuesday, February 22, 2011

External/Custom promotions loader for WCS

This article is more relevant for 6.0, As I am not sure, how much Management center makes it easier to create promotions and how much effort does it take compared to Accelerator. I did work on some on POC for management center and found it relatively easier to accelerator.

Promotion engine is really powerful and Accelerator only has limited functionality exposed.In the past I have worked on loading new promotion types that are supported by promotion engine using loading via spreadsheets and also same approach can be used to load external promotions into WCS.

The promotions loader essentially has to put entries and XML into the following tables.
PX_PROMOTION
PX_GROUP
CLCDPROMO
CALCODE
CALCODEDSC
CATENCALCD --product promotions
CATGPCALCD--category promotions

It is still a maintenance struggle from what I have seen in production for a couple of years but the functionality is not that hard to implement and these promotions are visible in Accelerator and can be disabled or deleted but these could not be edited in Accelerator because they were for created for custom features that had no OOB Accelerator support.

Tuesday, February 15, 2011

DynaCache problem ! Any Exception will result in not caching response

IBM run time has underlying low level logic to designate a page/entry uncacheable in the event of any system exception. Even if the system exceptions are caught from custom code. It still ends up not caching the entry.
e.g.
If you have any extra parameters in the URL that could cause any exceptions. The output of the servlet is not cached.

Do make sure before passing parameters to OOB commands beans. Validate the ID's that will help for some cases.

Tuesday, January 25, 2011

Policy For Stacking Shipping promotions

If you have a client that requires multiple shipping promotions to be applied on an order.
By default there can only be 1 shipping promotion applied on any order.

1). update px_policy set status = 1 where name in ('Shipping: Any order item can only participate in one promotion') and store_id = STORE_ID
2). Get the xmlparam data for this policy: select xmlparam from px_policy where name in ('Shipping: Any order item can only participate in one promotion') and store_id = STORE_ID
3). Update the xmlparam
Before:
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy
.EachItemCanParticipateInPromotionOncePolicy"
&.......;/StoreKey></PromotionPolicyKey><Status>Active</Status></PromotionPolicy>
After:
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy.
EachItemCanParticipateInPromotionOncePolicy"&
.........;</StoreKey></PromotionPolicyKey><Status>Inactive</Status></PromotionPolicy>

4). restart the server