Pages

Wednesday, November 9, 2011

Ensure that the host name is a fully qualified host name


Problem:

Installation of a Websphere Commerce fix pack or enabling / disabling features in a feature pack throws an error similar to the following

Ensure that the host name is a fully qualified host name.

Example below shows an error that I encountered while applying Fix pack 4 on Websphere Commerce v 7.0

PropCheck:

ApplyDBFixpack:

GenerateANTProperties:

BUILD FAILED
E:\IBM\WEBSPH~1\COMMER~1\components\Fixpack\xml\configureDatabaseFixpack.xml:66: The following error occurred while executing this line:
E:\IBM\WEBSPH~1\COMMER~1\components\Fixpack\xml\configureDatabaseFixpack.xml:389: Ensure that the host name is a fully qualified host name.

TO rectify this, first ensure that the system on which commerce is installed has a fully qualified hostname. To check this, follow the instructions in the link below


Step 2 is to check your instance xml file <<WC_InstallDir>>/instances/<<instancename>>/xml/<<instance>>.xml and search for “Webserver” section in the file and change the hostname to the fully qualified hostname rather than localhost (e.g. hostname.domain.com)

Reference


Thursday, November 3, 2011

Uninstalling Feature pack installed on Websphere commerce


First step is to disable installed features of the feature pack on Websphere Commerce Server 7.0

Assuming current installation information
  1. IBM WCS 7
  2. IBM WCS Fix pack 2
  3. IBM WCS Feature Pack 2 on top of Feature pack 1
Feature pack 2 provides the following features
  1. content-version
  2. social-commerce
  3. store-enhancements
  4. management-center
  5. foundation
The features must be disabled in the order as shown above starting from a to e

Steps to uninstall feature pack

  1. Disable the features of the Feature pack
    1. Take a backup of the existing WCS configuration by issuing the following commandWC_profiledir/bin/backupConfig.bat backup_file.zip  (Windows)
    1. Backup the database (I am using DB2, so its pretty easy backing up using control centre)
    2. Disable features by issuing the following command for each feature that is enabled
config_ant.bat -buildfile
WC_installdir/components/common/xml/disableFeature.xml
-DinstanceName=
instance_name -DfeatureName=<<featurename>>
-DdbUserPassword=
db_password

where <<featurename>> is the name of the feature as detailed in a to e above except b.

For disabling social-enhancements, logon to WAS admin console and go to applications à websphere enterprise applications à and select WC_instance_name_soccom and click uninstall.
  1. Uninstall feature pack 2 by navigating to WC_installdir/uninstall.fep2 and click on Uninstall.exe. Follow the instructions. This will remove the feature pack 2.

Monday, October 10, 2011

Wishlist basics

Websphere commerce wish lists are stored in IITEMLIST table.
Items in the wish list are in IITEM table.

Query to list all wishlists by registered users


select IITM.STOREENT_ID, count(distinct ITMLST.IITEMLIST_ID) as NoOfWishLists from IITEMLIST ITMLST, IITEM IITM,USERS USR, STOREENT ST where IITM.IITEMLIST_ID = ITMLST.IITEMLIST_ID and IITM.MEMBER_ID=USR.USERS_ID and USR.REGISTERTYPE = 'R' group by IITM.STOREENT_ID

Thursday, September 8, 2011

Access control policies - Staging and Production


Access control policies

Problem: New extended site store was created / published on staging environment but the out of the box store policies did not propagate through to the production.

Resolution: The default access control policies have to be manually loaded to the production environment. The steps below describe how to load the ACP.

  1. Extract the accesscontrol.xml file from the store archive file that you want the policies to be loaded for. For example, if you have published Madisions.sar under the ExtendedSites, then extract the accesscontrol.xml from the path in the SAR
/WEB-INF/stores/StoreAssetsDir/data/accesscontrol.xml

  1. Edit the accesscontrol.xml file extracted in the above step to make it a valid XML file. Add the following at the top of the file (as first three lines)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE import SYSTEM "../../../schema/xml/wcs.dtd">
<import>

          And then close the import tag at the end of the file
         
</import>

  1. In the XML, replace all the references of "&STORE_IDENTIFIER_RPS; with the name of your store. For example, Madisons (ie. refer to the STOREENT.IDENTIFIER field in the database for this value).
For example, replace "&STORE_IDENTIFIER_RPS;” with MadisonStorefrontAssetStore

<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="&STORE_IDENTIFIER_RPS; PolicyGroup" member_id="@profile_mbr_id"/>

<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="MadisonStorefrontAssetStore PolicyGroup" member_id="@profile_mbr_id"/>

  1. Replace all occurrences of "@profile_mbr_id" with the member id who owns the store (please check storeent.member_id for details)
<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="&STORE_IDENTIFIER_RPS; PolicyGroup" member_id="@profile_mbr_id"/>

Replace with

<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="&STORE_IDENTIFIER_RPS; PolicyGroup" member_id="7000000000000000001"/>

  1. Replace all occurrences of @profile_orgentity_id with the same value as above
<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="MadisonsStorefrontAssetStore PolicyGroup" member_id="@profile_orgentity_id"/>

<acpolgrp acpolgrp_id="@acpolgrp_id_1" name="MadisonsStorefrontAssetStore PolicyGroup" member_id="7000000000000000001"/>

  1. Once the changes to the xml are completed, copy the xml to the following folder location on the target environment where policies have to be loaded.
<<WC_Install_Dir>>/xml/policies/xml

  1. Run the idresgen command to resolve ID’s. Ensure that you run the idresgen on the target database (production in this case). The syntax of the idresgen is as below
idresgen.cmd -dbname <<name>> -dbuser <<user>> -dbpwd <<pwd>> -infile <<infilepath>> -outfile <<outfilepath>> -method mixed -schemaname <<schemaname>>

replace
<<name>> with database name,
<<user>> with the websphere commerce database user
<<pwd>> with the database password
<<infilepath>> is the file path. For example, E:\IBM\Commerce\xml\policies\xml\accesscontrol.xml
<<outfilepath>> is the output file path. This is the output file that is generated after running the idresgen command
<<schemaname>> is the database schema name which if left out will default to the –dbuser parameter.


  1. The idresgen command above will generate a XML file by resolving the primary keys for the entities in the input xml. To keep the production database exactly same as the staging one, we need to modify the xml output of the idresgen utility and replace all ID’s with that of the staging environment.

  1. After the above step is complete, run the massload utility to actually load the access control policies for the new store.

massload.cmd -dbname <<nameofdb>> -dbuser <<user>> -dbpwd <<passwd>> -infile <<resolvedxmlFilePath>> -method sqlimport -commitcount 200 -schemaname <<schemaname>>

          nameofdb – Name of the Database
          user – Database user
          passwd – database password
          resolvedxmlFilePath – complete path to the resolved XML File
 
This resolved the access control issue on production environment for default out of the box store policies.





Wednesday, July 27, 2011

Stop Search Engines to Indexing your site

This is something unrelated to IBM WCS but I encountered a situation where I had to do this on a IBM WCS powered ecommerce site.
To prevent a Search Engine from indexing a page, place the code below between the <HEAD> and </HEAD> tags.


<META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">

This tag tells the robots not to index this page and not to follow any links within the page.

<META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW">

This tag tells the robots not to index this page, but follow any links within the page.


Another way is to place a Robots.txt file under the webroot folder of the webserver with the following contents


User-agent: *
Disallow: /
 
This will disallow indexing on the whole site