Saturday, April 30, 2011

Punchout with Commerce systems

Punchout is a common paradigm called for sharing catalog and transfer cart at run time between different systems procurement and e-commerce systems.

Different 3rd party systems popular for PunchOut
e.g. Ariba Supplier Network, Oracle Fulfillment, SMAPS

There are 2 ways to communicate, I have used point to point and using Ariba supplier network.

cXML is used for communication. (Commerce eXtensible Markup Language) is a protocol intended for communication of business documents between e-commerce and procurement applications. It is really easy to understand and use.

Punch out on Ariba: You need to configure in the admin tool
administration->configuration->electronic order routing
catalogs->create punchout Only

Integrating WCS with various Punchout system is very interesting. Will do a another blog on the details.

Friday, April 29, 2011

Create custom Registry for Performance\Store configuration

Creating registry is a great alternate solution for things you can not cache using dynacache. Another purpose would be to store configuration data for store. If you use registry, you don't need a server restart and org admin console provides a nice interface to refresh registry. You can load the registry on server start and connect a table to the registry and if you need to add stuff dynamically, you would need a registry refresh from admin console.

Add the Registry entry into wc-server.xml

<registry
name="CustomConfigRegistry" regClassName="com.vendor.registry.CustomConfigRegistry"/>


public class CustomConfigRegistry implements Registry {
private static final String CLASSNAME = "CustomConfigRegistry";
private static CustomConfigRegistry singleton = new CustomConfigRegistry();
private Timestamp lastRefreshTimeStamp = null;
private final int INITIAL_CACHE_SIZE = 20000;

private Hashtable configCache = null;

public CustomConfigRegistry () {}

public void initialize() throws Exception {
singleton = this;
configCache = new Hashtable(INIT_CACHE_SIZE);
}


public static CustomConfigRegistry getInstance() {
return singleton;
}


public boolean enabled() {
return (singleton != null && configCache != null);
}

public void refresh() throws Exception {
if (getCacheSize() > 0) {
System.out.println(" [CustomConfigRegistry] cache size = " + getCacheSize());
}
configCache = new Hashtable(INIT_CACHE_SIZE);
lastRefreshTimeStamp = new Timestamp(System.currentTimeMillis());
PerformLogic();
}

public int getCacheSize() {
if (enabled()) {
return configCache.size();
} else {
return -1;
}
}

public void performLogic(){
}
}

Login to Admin Console->Registry->check the CustomConfigRegistry registry and update.
or
Directly refresh
http://myhostname/webapp/wcs/stores/servlet/RefreshRegistry?URL=/webapp/wcs/Admin/homepg&registryName=CustomConfigRegistry

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