Wednesday, June 25, 2014

CMN8413E: The messaging system cannot find an appropriate profile | Enable transports in V7

If you see an error similar to the one below, most likely your transport is inactive.

[6/25/14 14:05:41:279 PDT] 00000047 CommerceSrvr  A com.ibm.commerce.messaging.outboundservice.Messaging loadAdminData(Integer,Integer,Integer) CMN8413E: The messaging system cannot find an appropriate profile for MSGTYPE_ID "101" to match an active transport of the STORE_ID "10051" in table PROFILE. Ensure that the MSGTYPE has been assigned to an active transport under the store or site.

Login into Admin console and activate Websphere MQ by changing status as show in the image on the right.

If the transports are not visible enable them from wc-server.xml. In V7 by default they are not enabled so 

Search for the string below in wc-server.xml and make enable true and similarly you can do it for other transports: A couple of enabled transport xml snippets from wc-server.xml below.
<OutboundConnector
        default="true"
        enabled="true" id="3"
        name="JMS" retries="3">
...
  <OutboundConnector
        default="true"
        enabled="true" id="1"
        name="JavaMail" retries="3">
        <JNDI
          JndiName="eis/JCAEmail" display="false"/>
...



Thursday, June 12, 2014

Data Loader Override FullImage, Thumbnail scenario fix or any other columns exclusion

This blog explain a scenario where  FULLIMAGE and THUMBNAIL are overridden in table CATGRPDESC even when the CSV files is not passing the values for these fields.
This can be used to apply column level exclusions for any other component similarly so these fields are not overridden.


C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.catalog\dataload\wc-loader-catalog-group.xml

Pasting a block where the change is required..this XML has much more business object configurations:
 <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader">
  <_config:ColumnExclusionList>   
    <_config:table name="CATGRPDESC" columns="FULLIMAGE,THUMBNAIL" />
  </_config:ColumnExclusionList>  
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
......
......
.....

Sample RunProductLoad.bat for testing, make sure the path for wc-dataload-catalog-group.xml is correctly done as it is pointing to relative below:

@echo off
setlocal
cd "C:\IBM\WCDE_ENT70\bin"
call dataload ..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\wc-dataload-catalog-group.xml -DXmlValidation="false" -DComponent=CustomDataLoad\MasterCatalog -DFeedHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload -DWCConfigHome=C:\IBM\WCDE_ENT70\workspace\WC\xml\config -DCVConfigHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload\Config
endlocal


Sample CSV file: CatalogGroup.csv, GroupIdentifier points to CATGROUP.IDENTIFIER and ParentGroupIdentifier is the parent from CATGRPREL

Start date 2013-01-28 16:40:42 
GroupIdentifier,ParentGroupIdentifier,TopGroup,Sequence,Name,ShortDescription,Published
36010,310010,FALSE,0,Sample & Decors,Sample & Decors,1

If you have spaces before of GroupIdentifier or ParentGroupIdentifier: It causes this issue below:

Exception message:
The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
Stack trace:
com.ibm.commerce.foundation.dataload.exception.DataLoadApplicationException: The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable.resolveId(IDResolverForOneTable.java:339)
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverImpl.resolveId(IDResolverImpl.java:369)
at com.ibm.commerce.foundation.dataload.util.DataLoadHelper.resolveIds(DataLoadHelper.java:2818)

Success or failure: logs folder in toolkit: Sample success log

Load summary for load item: CatalogGroup.
----------------------------------------------------------------------------------
Business Object Configuration: C:\IBM\WCDE_ENT70\workspace\WC\xml\config/com.ibm.commerce.catalog/dataload/wc-loader-catalog-group.xml
Data loader mode: Replace.
Batch size: 1.
Commit count: 100.
Error Tolerance Level: 1.
Error Count: 0.
Amount of data processed: 3.
Amount of business objects processed: 1.
Amount of business objects committed: 1.
Data loader initialization time: 1 seconds.
Data loader completed in 4.236 seconds.
Total flush time: 0 seconds.
Total commit time: 0.002 seconds.
CSV file location: C:\IBM\WCDE_ENT70\bin\..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\CatalogGroup.csv.
Affected tables (6):
Table name: CATGROUP, Affected number of rows: 1.
Table name: STORECGRP, Affected number of rows: 1.
Table name: CATGRPDESC, Affected number of rows: 1.
Table name: CATTOGRP, Affected number of rows: 0.
Table name: CATGRPREL, Affected number of rows: 1.
Table name: TI_DELTA_CATGROUP, Affected number of rows: 1.

Wednesday, May 21, 2014

IBM HTTPS Key expired | All HTTPS URL's failing

If you can't get to any of the HTTPS pages this is probably it. 

Here are the steps to fix:

1.  Open iKeyMan - C:\IBM\HTTPServer\bin\ikeyman.bat

2.  Click the open folder and retrieve file: C:\IBM\HTTPServer\SSLKeys\sslkeys.kdb -  Enter the password e.g. "Pass0wrd".

3.  Click "Delete".  

4.  Click New Self-Signed...

5.  Type in label "CLIENT_INITIALS".

6.  Save/Close it.

7.  Open your Windows Services and restart the IBM HTTP Server.

8.  Restart your toolkit (if started already).

9.  Test https://localhost

Wednesday, April 23, 2014

"oracle.jdbc.pool.OracleConnectionPoolDataSource" could not be found

Error below, can happen due to multiple reasons on server start, if it can't locate the Oracle JDBC driver. please find below some of the resolution steps that may help debug.

J2CA0036E: An exception occurred while invoking method setDataSourceProperties on com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl used by resource jdbc/WebSphere Commerce Oracle DataSource demo : com.ibm.ws.exception.WsException: DSRA0023E: The DataSource implementation class "oracle.jdbc.pool.OracleConnectionPoolDataSource" could not be found.
    at java.net.URLClassLoader.findClass(URLClassLoader.java:423)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)


Resolution:
ToolkitModuleConfig.xml -->Update XML to point to correct toolkit location.
Close toolkit
Run setDBType          (For Oracle 11g Oracle home:: Oracle\product\11.2.0\client_1)
Which updates wc-server.xml and variables.xml for oracle home.
Right click on server and click clean.

In wc-server.xml
Also make sure the JDBCDriverLocation is correctly pointing to the JDBC driver location.
<Websphere
            DatasourceName="WebSphere Commerce Oracle DataSource demo"
            HelpServerHostName="localhost" HelpServerPort="8001"
            JDBCDriverLocation="C:\IBM\Oracle\product\11.2.0\client_1\jdbc\lib\ojdbc6.jar"
            JDBCDriverType="native" WASProfileName=""
            appUpdateTimeout="1800000" applicationName="WC" port="900"> 




Monday, April 7, 2014

Encryption key based algorithms in Commerce | Error Invalid Key Size

I have encountered this since older versions of commerce, all the way to V7 and this could happen with any type of key based encrypted algorithms. In this scenario, I was testing AESCipher using AES encryption but can happen working on multiple algorithms with larger key size.

This error is caused by restrictions in some countries with key size and hence the default Java spec does not provide unlimited key strength as a default configuration and it requires the policy jars to be updated.

Back up the following files from C:\IBM\SDP\runtimes\base_v7\java\jre\lib\security and get the latest files for IBM JDK and replace with these existing files and restart. Do not get these files below from Oracle.com as IBM uses it's own SDK.

US_export_policy.jar
local_policy.jar
Steps to download the IBM JDK security files:
http://pic.dhe.ibm.com/infocenter/asehelp/v8r8m0/topic/com.ibm.ase.help.doc/topics/t_update_java_sdk_policy_files.html

This step would be required on all the server environments similarly to update the policy files.

Thursday, April 3, 2014

Freaky toolkit | Error | Loose archive URI

When adding a new custom payment plugin project or any new EJB project.  One of the options that is selected is added project to EAR (WC) and one of the configurations is to add the Module dependency in WC project. From my experience, it is important to generate a localized version of new module in the file and then perform WC publish.

  W org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl collectFilesFromLooseArchives Archive URI [ C:\IBM\WCDE_ENT70\workspace\WC ]: Loose archive URI [ CustomPaymentPlugin.jar ] Loose Archive [ org.eclipse.jst.j2ee.commonarchivecore.looseconfig.internal.impl.LooseLibraryImpl@4b1e4b1e (uri: CustomPaymentPlugin.jar, binariesPath: C:\IBM\WCDE_ENT70\workspace\CustomPaymentPlugin\ejbModule, resourcesPath: C:\IBM\WCDE_ENT70\workspace\CustomPaymentPlugin\ejbModule) ]: Already mapped to [ com.ibm.etools.commonarchive.impl.EJBJarFileImpl@ef70ef7 (URI: CustomPaymentPlugin.jar, lastModified: 0, size: 0, directoryEntry: , originalURI: CustomPaymentPlugin.jar) (types: null) ]

C:\WCDE_ENT70\workspace\WebSphereCommerceServerExtensionsData\.settings\org.eclipse.wst.common.component

e.g.
        <dependent-module archiveName="CustomPaymentPlugin.jar" deploy-path="/" handle="module:/resource/CustomPaymentPlugin/CustomPaymentPlugin">
            <dependent-object>Module_1395371978911</dependent-object>
            <dependency-type>uses</dependency-type>
        </dependent-module>




As a practice if org.eclipse.wst.common.component is getting checked into repository by developers.
Some times it may break your sever start with the above error and for the developer who works on the module, it may work as the module number is a generated on a local toolkit but for others, they need to go into the above dialog by WC-->right click->properties and goto Java EE module dependencies and uncheck and click ok and go back in there and check the corresponding module and click ok so the localized version is generated and publish WC project

Tuesday, March 25, 2014

Access Control Policies overview !!

There are 2 levels of access controls provided for WebSphere Commerce.
1. WAS protects EJB's and Servlets.
2. WebSphere Commerce provides low level fine grained access control  framework based on access control policies to various types of users (registered/guest/customer service rep/sales managers).
and
3. It is always recommended to guard a WebSphere Commerce Server is always by a Firewall that will help internet clients from not being able to directly access resource in WebSphere Commerce.

WebSphere Application Server layer security and access control: 

1. Servlets and EJB's are configured to be invoked only by a chosen identity through declarative security and hence during EJB creation, we select use identity of EJB server and using identity of EJB server field ensures that all EJB beans run under the same identity for security.
2. WAS provides multiple security features such as 1. Global Security. 2. security domains can be configured with different scope 3. WAS utilizes SSL for secure connection between client and server and hence any third party integration's requires certificates to be installed. 4. In cases where standard authentication is not sufficient, WAS supports JAAS for higher level of security.

WebSphere Commerce Access Control Framework: Authorization model

Info center provides a good read on users/actions/resources//relationships but i am going to start with the practical case. There are always cases when we need to implement a custom access policy but most of the times, when adding access control in *ACP.xml. There are 2 levels of access control
  •    Command Level access control
  •    Resource Level access control
"Access control policies are enforced by the access control Policy Manager. 
In general, when a user attempts to access a protected resource, the access control policy manager first determines what access control policies are applicable for that user 
and then, based upon the applicable access control policies, it determines if the user is allowed to perform the requested operation on the given resource".

Most developers need to get the basic view and command level entries right, which is explained below and only on few times, would get an opportunity to implement custom access policy.


1. We create actions for views and commands
<Action Name="ABCItemExtView" CommandName="ABCItemExtView" />
<Action Name="ABCSyncPersonControllerCmd" CommandName="ABCSyncPersonControllerCmd" />
<Action Name="com.custom.soi.member.commands.ABCSyncPersonControllerCmd" CommandName="com.custom.soi.member.commands.ABCSyncPersonControllerCmd"></Action>
2. Assign actions to action groups as ActionGroupAction for views 
E.g. action groups
<ActionGroup Name="ProductManagersViews" OwnerID="RootOrganization">
<ActionGroup Name="AllSiteUsersViews" OwnerID="RootOrganization">
<ActionGroup Name="RegisteredUserViews" OwnerID="RootOrganization">
<ActionGroup Name="CustomerServiceRepresentativeViews" OwnerID="RootOrganization">
Assignment example:
<ActionGroup Name="ProductManagersViews" OwnerID="RootOrganization">
      <ActionGroupAction Name="ABCItemExtView"/>
     </ActionGroup>

<ActionGroup Name="RegisteredUserViews" OwnerID="RootOrganization">
       <ActionGroupAction Name="ABCSyncPersonControllerCmd" />
</ActionGroup&gt

3. Creating resource categories for commands
ResourceBeanClass="com.custom.soi.member.commands.ABCSyncPersonControllerCmd">

4. Assigning resource category to resource groups for commands as ResourceGroupResource

e.g. Resource groups
<ResourceGroup Name="AllSiteUserCmdResourceGroup" OwnerID="RootOrganization">
<ResourceGroup Name="CustomerServiceRepCmdResourceGroup" OwnerID="RootOrganization">
<ResourceGroup Name="RegisteredUserCmdResourceGroup" OwnerID="RootOrganization">

<ResourceGroup Name="BecomeUserCmdsResourceGroup" OwnerID="RootOrganization">
Assignment example:
<ResourceGroup Name="AllSiteUserCmdResourceGroup" OwnerID="RootOrganization">
<ResourceGroupResource Name="com.custom.soi.member.commands.ABCSyncPersonControllerCmdResourceCategory" />
</ResourceGroup>

Run acpload or in V7, dataloader will take care of it as it would internally run the ACPLoad
CMD:
select * from acresgrp where acresgrp_id in
(
select acresgrp_id from acresgpres where acrescgry_id =
(select acrescgry_id from acrescgry where resclassname like '%ABCSyncPersonControllerCmd%')
)

VIEWS:
select * from acpolicy where acactgrp_id in (select acactgrp_id
from acactactgp where acaction_id
in (select ACACTION_ID from ACACTION where ACTION = 'ABCItemExtView'))

select groupname from ACACTACTGP a, ACACTGRP b where acaction_id = (select acaction_id from ACACTION where action like '%ABCItemExtView%')
and a.acactgrp_id = b.acactgrp_id


Reference:
http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.data.doc/refs/rdmattrdict.htm

Acronyms:
WAS: WebSphere Application Server
SSL : Secure Socket Layer
JAAS: Java Authenticating and Authorization services