Tuesday, October 16, 2018

Promotion Related DB queries

Promotion Related DB queries.
OrderItem cacode relation -->ORDICALCD
Calcode with px_promotion -->CLCDPROMO

--This table contains all the Promotion that is created and it can be identified by the name Under the column "NAME"
select * from PX_PROMOTION where PX_Promotion_id=10001;

-- This table contains all the promotions that are created and the promotion name is present under "CODE" column
select * from calcode;

-- This table contains all the promotion codes available for the particular store.
select * from px_cdpool;

-- This table contains all the promotion code information for relationships with a promotion.
select * from PX_CDPROMO;

-- This table contains all the promotion code usage information.
select * from PX_CDUSAGE;

-- This table contains all of the coupons issued to individual customers.
select * from PX_COUPON;

-- This table contains promotion description information.
select * from PX_DESCRIPTION ;

-- This table Contains the promotion group information (i.e. under the grpname we can classify the type of promotion it belongs to).
select * from PX_GROUP;

-- This table contains promotion policies (based on the storeent_id we can classify the promotions and also we can get the status of the promotion).
select * from PX_POLICY;

-- This table contains details about how promotions are applied to an order.
select * from PX_PROMOARG;

-- This table contains statistics about promotion usage.
select * from PX_USAGE;

Monday, September 3, 2018

manually generate heapdumps in Websphere


To manually generate heapdumps, set a JVM parameter. Then send the JVM process an interrupt (signal 3), a javacore and a heapdump will be generated.

In the Administrative Console:
Servers > Application Servers > serverName:
In the Server Infrastructure section open Java and Process Management, then select Process Definition:
In the Additional Properties select Java™ Virtual Machine:

Add the following string to the Generic JVM arguments field:
-Xdump:heap:events=user

Press OK, and save the configuration.

Note: The Application Server will need to be recycled for the setting to take effect.


To generate the heapdump, send the Application Server an interrupt. Use the "kill" command:
kill -3 <java process ID>

To get process id
ps -aux | grep java   (Look for server1)

Monday, July 9, 2018

SRVE0216E: post body contains less bytes than specified by content-length

i was writing service handle HTTP POST request and come accross below exception




00000070 SRTServletReq E com.ibm.ws.webcontainer.srt.SRTServletRequest parseParameters SRVE0133E: An error occurred while parsing parameters. {0}
                                 java.io.IOException: SRVE0216E: post body contains less bytes than specified by content-length
    at com.ibm.ws.webcontainer.servlet.RequestUtils.parsePostData(RequestUtils.java:311)



Using data : JSON.stringify(json) , in the AJAX call resolved issue

Sunday, July 8, 2018

REST POST CALL with JSON BODY in Websphere commerce

REST POST CALL with JSON BODY in Websphere commerce. The code below is an example of a POST request that requests and receives a JSON string response. The Apache Wink framework also supports GET and other applicable request types, but for the purposes of this example a POST request will be leveraged.
Apache Wink REST Client Creation Tutorial for WebSphere Commerce
Step 1. Create a ClientConfig object. This object will be used to configure and construct a RestClient.
By default, the client uses the java.net.HttpURLConnection for issuing requests and responses; but the Apache HttpClient can also be used. In my experience with WebSphere Commerce v7.0, I recommend using the ApacheHttpClientConfig object as shown below to construct your ClientConfig object.
Configure and set appropriate properties on the ClientConfig object, such as the readTimeout and connectTimeout properties.
NOTE: After a ClientConfig object is used to construct a RestClient object, the ClientConfig object can no longer be modified and will result in a ClientConfigException error.

// import org.apache.wink.client.ApacheHttpClientConfig;
// import org.apache.wink.client.ClientConfig;
ClientConfig clientConfig = newApacheHttpClientConfig();
clientConfig.readTimeout(readTimeout);
clientConfig.connectTimeout(connectionTimeout);

Step 2. Create a RestClient with the ClientConfig object created and configured previously.

// import org.apache.wink.client.RestClient;
RestClient restClient = newRestClient(clientConfig);

Step 3. Create a Resource object with your REST service URI from the REST client object. Configure and set appropriate properties on the Resource object, and add any required headers to the request. Ensure you set the appropriate MediaType you expect to receive in response to your REST service call.

// import org.apache.wink.client.Resource;
// import javax.ws.rs.core.MediaType;
Resource restResource = restClient.resource("http://www.example.com/some/rest/service");
restResource.accept(MediaType.APPLICATION_JSON);
resource.header(ECConstants.EC_CONTENT_TYPE, MediaType.APPLICATION_JSON);
resource.header("Authorization","<Basic cmFjaGVsLmZvb0BmYWly>");
restResource.header("HeaderField", "HeaderValue");

Step 4. Creating JSON object to send in body for POST call

String json=null;
Map detailsMap = new LinkedHashMap<String, String>();
    detailsMap.put("ticket",detailsMap);
                    ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
                    try {
                    json = ow.writeValueAsString(detailsMap);
System.out.println("request proprs :::: "+json);
            } catch (JsonProcessingException e) {
            e.printStackTrace();
}

Step 5. Execute a GET or POST call, and process the response by using the status code, response headers, or the response message body as needed.

// import org.apache.wink.client.ClientResponse;
ClientResponse clientResponse = restResource. .contentType(MediaType.APPLICATION_JSON).post(json.toString());
int statusCode = clientResponse.getStatusCode();
String responseEntity = clientRepsonse.getEntity(String.class);
            }


NOTE: Instead of calling the response.getEntity(String.class) to retrieve a String response, you can use any other class that has a valid javax.ws.rs.ext.MessageBodyReader object.
And there you go, you’ve implemented an Apache Wink REST service client, and can now process the response as your application requires.

Tuesday, May 29, 2018

Using LIKE wildcard in prepared statement

Using “like” wildcard in prepared statement

Query : SELECT COUNT(o.orders_id) AS orders,ROUND(SUM(o.totalproduct),0) AS ordersum,ROUND(AVG(o.totalproduct),0) AS orderavg FROM orders o, users usr WHERE o.member_id=usr.users_id and  o.timeplaced like  ? and usr.field1='IU' and o.status='M'

In Java:
String mmSearch = "%";
            Set<String> keys = previousOrdersDateMap.keySet();
            for(String key: keys){
               if(null != key){
                               key = mmSearch+key+mmSearch;
                PreparedStatement preparedStatement = conn.prepareStatement(detQryType);

                preparedStatement.setString(1,key);

Friday, May 25, 2018

Writing REST handler in ibm wcs

Writing REST handler: If you are writing a custom handle in WCS follow below steps:

1.       Make entry of your custome handler in resources-ext.properties at below path
Rest\WebContent\WEB-INF\config\resources-ext.properties

e.g com.mycomp.commerce.rest.handlers.ExMyHandler

Now lets try to get value passed in header for GET request

package com.mycomp.commerce.rest.handlers.ExMyHandler;

import java.util.Set;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;

@Path("store/{storeId}/http-header/")
public class HttpHeaderService extends AbstractClassicResourceHandler {
               
                @GET
    @Produces( { "application/atom+xml", "application/json", "application/xml" })
    @Path("/queryheader")
    public Response findHeader(@PathParam("storeId") String storeId, @QueryParam("responseFormat") String responseFormat, , @Context HttpHeaders httpHeaders) {
                String METHODNAME = " findHeader()";
                LOGGER.entering(CLASSNAME,METHODNAME);
        Response result = null;
        String cacheControl = httpHeaders.getRequestHeader("Cache-Control").get(0);
        System.out.println("Cache-Control: "+cacheControl);
        /** get list of all header parameters from request **/
        Set<String> headerKeys = httpHeaders.getRequestHeaders().keySet();
        for(String header:headerKeys){
            System.out.println(header+":"+httpHeaders.getRequestHeader(header).get(0));
        }

        LOGGER.exiting(CLASSNAME,METHODNAME);
System.out.println("----------"+result);
        return result;
    }


Now use below URL in POSTMAN to get header query results:



Results in console : All parameter passed in header will come in system out

[5/25/18 12:40:56:611 IST] 000001ad SystemOut     O Cache-Control: no-cache
[5/25/18 12:40:56:611 IST] 000001ad SystemOut     O Accept:*/*
[5/25/18 12:40:56:611 IST] 000001ad SystemOut     O Accept-Encoding:gzip, deflate
[5/25/18 12:40:56:612 IST] 000001ad SystemOut     O Cache-Control:no-cache
[5/25/18 12:40:56:612 IST] 000001ad SystemOut     O Connection:keep-alive
[5/25/18 12:40:56:612 IST] 000001ad SystemOut     O Content-Type:application/json
[5/25/18 12:40:56:612 IST] 000001ad SystemOut     O Cookie:JSESSIONID=0000XFHI_0g_W1W40QAO34yPPQ8:-1
[5/25/18 12:40:56:613 IST] 000001ad SystemOut     O emailId:pawan@gmail.com
[5/25/18 12:40:56:613 IST] 000001ad SystemOut     O Host:localhost
[5/25/18 12:40:56:613 IST] 000001ad SystemOut     O Postman-Token:d299a6ae-91a6-4710-8a73-223c1b5d63f0
[5/25/18 12:40:56:614 IST] 000001ad SystemOut     O User-Agent:PostmanRuntime/7.1.1
[5/25/18 12:40:56:614 IST] 000001ad SystemOut     O WCToken:125002%2CrbkigQ6NXpcvA2fu2rhe%2BasrZVIbdxvJavsmYi4OFe%2BglUf9Mbq%2F9lz37NMjdk0PvgsSZf5quQghTNL7TTFAbSa03WFEAqmO4tZ5zlRXlCgdQTYfJwH4jY%2B%2FnuRHTaqRjLghrBE%2ByI8jsBbmU80TZQVslYSsLJsSxDIS8hRhaZp9RUjh16nc2iROD7xdj7Q81bPln7rsgYXt6XuttxhQ%2F1uS1jLHY5dM3b07d9pffKj3kT4K6FmA7W%2FRvxLm%2B%2Foh

[5/25/18 12:40:56:614 IST] 000001ad SystemOut     O WCTrustedToken:125002%2CWb5DERrSx6keRM7Ql1yJjh5pYbYy2URYgvSGu0J3cMk%3D

Generating tokens to use REST service in ibm wcs

Generating tokens to use REST service:
Step 1: To get token, Access below REST service with JSON content mention as below

Content to Send:
{
  "logonId" : "abc@gmail.com",
  "logonPassword" : "password"
}
Step 2: In response to above request you will get WCToken and WCTrustedToken which you need to send to further request to access rest of the APIs.
e.g.
{
  "WCToken": "74022%2C7Vc3U%2B7zdArch8iwDFNsSnBJ0odKFI4wkb19WwiWLIwK1tfO%2B4X4tptjpXYoMlHAxtn1iojIdpFj4TUmFV5NGX%2BoxEB1EobxP87w1hm1Sp6Q8adx8pnUVH0UDljzfs5k2FhDroNrcE0K%2F7EpEjEAlLyzT13bBce4af%2BERKPpnDMxxJvc%2Bt8jBR4JfALSnJy6iJ2MVL3vAdwyOvgijRQia6Rs4MWUgIqkzZbuMczAmWU%3D",
  "userId": "74022",
  "personalizationID": "1494826057535-7",
  "WCTrustedToken": "74022%2C%2BB50W0QUpH426rBLfEmg0CD4GpotVzeIvRetPHtY55M%3D",
  "addressId": "27614181409"

}

Wednesday, May 23, 2018

Using Storefront Test Automation IBM WCS

Storefront Test Automation Engine
Using Storefront Test Automation Engine of WCS v7 FEP6
The Storefront Test Automation Engine (STAE) facilitates the process of writing, maintaining, and running test scripts to test the store functionally
Below are the components of STAE
Test Suite
Test Suites are built based on JUnit and are used to select the test case that must be run.
Test
A Test performs a few tasks from different page objects to test a storefront flow. Since all tests are built using JUnit version 4, all methods must match the following criteria to be identified as a test:
·         Be annotated with @test annotation
·         Be public
·         Have no arguments
Methods that are annotated with @Before are called before each test case. They are used to prepare the data that is required by the test.
Methods that are annotated with @After are called after each test case. They are used to release resources after a test is complete or complete a cleanup.
Store Page Objects
Store page objects are Java classes that act as a high-level abstraction of the web page. They include relevant tasks and the element identifiers found on the web page that is used         by the tasks. Example: AuroraFrontPage class is a SPO
Web test engine
This layer offers functionality to the tests to interact with a web browser. We have option to use HTMLUnit or test via browsers like Firefox, IE and chrome using the Selenium server
Setting up and running tests
Installing the Storefront Test Automation Assets
We need to download the WC_V7.0_-_FEP6STSTORECOMPASSETSMPEN.zip file from IBM Partnerworld site. Once downloaded, extract the zip to a temp folder.




Step 1: Open IBM Installation Manager



Step 2: Add the downloaded test asset store repository using File->Repositories link and click Install. You will be provided with the below page.Select the Companion Asset for FEP 6 and click NEXT



Step 3: Accept the License Agreement and click Next



Step 4: Provide path and click next



Step 5: Select all options and click Next



Step 6: Click Install



Step 7: Verify if the installation is a success and click Finish



Step 8: After installation, go to the installation directory and unzip all zip files available there
Setting up the Storefront Test Automation Engine
Pre-requisites
We need to download the below items to setup the STAE
JUnit
Latest JUnit version can be downloaded from
http://sourceforge.net/projects/junit/files/junit/
Selenium Server
Latest version can be downloaded from
http://docs.seleniumhq.org/download/
HttpClient, HttpCore and HttpMime
Latest version can be downloaded from http://hc.apache.org/downloads.cgi and http://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime
Some test scripts require setup steps that access WebSphere Commerce Accelerator or IBM Management Center for WebSphere Commerce. To do so, the Storefront Test Automation Engine makes HTTP calls to the WebSphere Commerce back-end tooling using HttpClient.

Google Guice

Latest version can be downloaded from http://code.google.com/p/google-guice/downloads/list
To use Chrome as a test browser, we must install separate ChromeDrive for use with Selenium. Get the latest from http://code.google.com/p/selenium/wiki/ChromeDriver
After downloading all the above required files, extract them to their respective temp folder. We need the JARs to setup the test project later
Setting up STAE:
        -      In RAD select File > Import.
        -      In the Import window, select General > Existing Projects into Workspace; then click Next.
        -      Select archive file option and then click Browse.
        -      Browse to the location where we installed Storefront assets and then select the zip file StorefrontTestAssetsWteFEP6.zip for Web testing or select MobileTestAssetsFEP6.zip for Mobile testing.
        -      Select the all projects shown and then click Finish.
Example: Wte, WCHTTPClient, WCWebTestEngine, and Aurora-Tests-Wte, Mobile-Wte
The Storefront Test Automation Engine projects are now in RAD. Since the library dependencies are not installed yet, the Problems view displays multiple compilation errors. We will resolve these errors in the next step.
Install the dependencies of the STAE
a.    In both the WCHTTPClient, Aurora-Tests-Wte, WCWebTestEngine and Wte projects, create the lib directory at the root of the project.
b.    Copy all of the JAR files related to HttpClient, HttpCore, HttpMime to the lib directory of the WCHTTPClient project.
c.    Add the above JAR files to the project build path.
d.    Browse to the directory on the file system that contains the extracted JUnit files. Copy thejunit-(version_number).jar file to the lib directory of the Wte project.
e.    Copy the following files to the lib directory of the Wte project:
      selenium-server-(version_number).jar
f.     Browse to the directory on the file system that contains the extracted Google Guice files. Copy the following files to the lib directory of the Wte project:
      Guice-(version_number).jar.
g.    Add the JARS to project build path

h.    In the Aurora-Tests-Wte project, browse to src\com\ibm\commerce, delete the url directory, and then refresh the project in RAD.
i.      Right-click the Aurora-Tests-Wte project and click Build Path > Configure Build Path. In the Projects directory remove any projects that are marked as missing.
j.     In the WCWebTestEngine lib folder add guice-(verison_number).jar and guice-assitedinject-(verison)number).jar.
k.    Add the same to the project build path
Running Tests

In the config.properties file present in Aurora-Tests-Wte project, change the following properties to reflect our environment:
# The host name of their server you are testing.
HOSTNAME=localhost
# The path part of the URL of the store to open (exluding the host).
STOREURL=/webapp/wcs/stores/servlet/en/aurora
# The browser type.
# Possible values: FIREFOX, INTERNET_EXPLORER
BROWSER_TYPE=FIREFOX
#Path to where screenshots are stored for failed test cases
SCREENSHOTPATH=c:/screenshots/
#Site administrator userid and password
ADMIN_USER_NAME=wcsadmin
ADMIN_PASSWORD=wcsadm1n
#URL of the esite store
ESITE_URL=/webapp/wcs/stores/servlet/StoreView?storeId=11001

 Use one of the following scenarios to run your tests:

Option
Description
Run the entire test bucket
a.    In the Java perspective of your Eclipse-based environment, locate the Package Explorer view and navigate to the tests directory.
b.    Locate the AllTests.java class.
c.    Right-click the AllTests.java class; then select Run As > JUnit Test.
Run a test scenario
d.    In your Eclipse-based environment, open the Package Explorer view and navigate to the tests scenario directory.
e.    Right-click the test script that you want to run; then select Run As > JUnit Test.
Run a single test case
Note: Since many test cases require data created by the FSTOREB2C_00.java test case, it is recommended that you run this test case first to populate the required test data.
f.     In your Eclipse-based environment, open the Package Explorer view and navigate to the tests scenario directory.
g.    Locate the test scenario that contains the test case you want to run; double-click the test scenario to open it.
h.    Locate the single test case that you want to run. There is one Java method for each test case.
i.      Right-click the Java method name for the test case; then select Run As > JUnit Test.



Future Work:

We can use Selemiun Grid which is part of Selenium 2 to run tests on multiple machines using multiple browsers to speed up the test case execution time or is we want to test multiple browsers simultaneously.

More info at:



http://docs.seleniumhq.org/docs/07_selenium_grid.jsp


Wednesday, May 16, 2018

Resolve ORA-011033: ORACLE initialization or shutdown in progress

Two way to resolve:

go to cmd prompt :



1.  Run below query

sqlplus system/Oracle_1@pdborcl as sysdba;
alter database open;

If it not work

2. Run below query..



> sqlplus /nolog

SQL> connect / as sysdba

Connected.

SQL> shutdown abort

ORACLE Instance shut down.

SQL> startup nomount

ORACLE Instance started

SQL> alter database mount;

SQL> alter database open;
Which still gave the error:

ORA-00600: internal error code, arguments: [kcratr1_lostwrt]
I then found the advice to do the following:

SQL> startup mount

ORACLE Instance started

SQL> recover database 

Media recovery complete

SQL> alter database open;

Database altered

Monday, April 16, 2018

Solr Search Customization by introducing a new facet in Websphere Commerce

schema.xml 

This file defines the schema fields and data type of the fields.This file also defines the SOLR field settings. Searchable,sortable SOLR fields are defined here.

Go to the below folder
<WCDE>\search\solr\home\MC_<master_catalog_id>\en_US\CatalogEntry\conf.

Open the file schema.xml in a text editor.

Search for the string “Catentry's basic attributes”. This will bring you to the section of the file where the index fields are defined.

The first block of index fields represent data from the CATENTRY table. Since the field1 value is also stored in the CATENTRY table, you need to add the new index field here.

 At the bottom of the CATENTRY fields add the line:

<!--    Catentry's basic attributes: map to table CATENTRY   -->
<field name="catentry_id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="member_id" type="long" indexed="true" stored="true" multiValued="false"/>
<field name="mfName" type="wc_text" indexed="true" stored="true"  multiValued="false"/>
<field name="buyable" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="field1" type="long" indexed="true" stored="true" multiValued="false"/>

Next we  will update the queries that are used to populate the Solr index from the WebSphere Commerce database tables. Each query needs to retrieve the data stored in field1 of the CATENTRY table.

wc-data-config.xml 

This file contains queries for getting data from preprocess tables (regular WC tables if necessary)to populate the search index. The query results are mapped to SOLR fields in this file. Open the file wc-data-config.xml.

(<WCDE>\search\solr\home\MC_<master_catalog_id>\en_US\CatalogEntry\conf)

The wc-data-config.xml file loads catalog entry data in three separate parts. Product data is loaded first. This is followed by bundle data and finally all other catalog entry types. For each of the three sections there is a query for populating the full index and another query for delta updates. For each section (product, bundle and other), you need to update the two queries and then add a new field element to assign the data from the WebSphere Commerce database to the field1 field in the Solr index. All together there are nine updates you need to make to this file.

Update the product queries and assignment.

1) Search for the string buyable from the top of the file. This is another column in the CATENTRY table that is already included in the query.
2) The first place you find the string is in the main product query. Add CATENTRY.FIELD1 to the SELECT statement immediately following CATENTRY.BUYABLE. Your updated query should look like the screen capture below.

query="SELECT CATENTRY.CATENTRY_ID,CATENTRY.MEMBER_ID,CATENTRY.CATENTTYPE_ID,CATENTRY.PARTNUMBER,CATENTRY.MFPARTNUMBER,CATENTRY.MFNAME, CATENTRY.BUYABLE,CATENTRY.FIELD1,STORECENT.STOREENT_ID

Search for buyable again. The second place you find the string is the delta index query. Make the same update to this query as you did to the previous one.

deltaImportQuery="SELECT CATENTRY.CATENTRY_ID,CATENTRY.MEMBER_ID,CATENTRY.CATENTTYPE_ID,CATENTRY.PARTNUMBER,CATENTRY.MFPARTNUMBER,CATENTRY.MFNAME, CATENTRY.BUYABLE,CATENTRY.FIELD1,STORECENT.STOREENT_ID,

Search for buyable once more. This brings you to the section where the data retrieved from the WebSphere Commerce database is assigned to the Solr index fields. Add an element under buyable to map the FIELD1 database column to the field1 index field. Your updated file should look like the screen capture below.

<field column="CATENTRY_ID" name="catentry_id" />
<field column="MEMBER_ID" name="member_id" />
<field column="PARTNUMBER" name="partNumber" />
<field column="MFNAME" name="mfName" />
<field column="BUYABLE" name="buyable" />
<field column="FIELD1" name="field1" />
                                                                                                                                                                 
Do the steps done for products for  bundles  if required

Make field1 a product facet by making entries in SRCHATTR, SRCHATTRPROP tables

Update the SRCHATTR table. Each row in this table represents the logical name of a catalog attribute that is defined in the search schema.

Enter the SQL below to add field1 to the table. You can use any available primary key, the value 101 is used here as an example. The value of ‘0’ for INDEXSCOPE indicates that this is a site-wide field.

insert into SRCHATTR (srchattr_id, indexscope, indextype, identifier)values (101, '0', 'CatalogEntry','_cat.Field1');

Update the SRCHATTRPROP table. This table stores information about which fields are defined as facets.

insert into SRCHATTRPROP (srchattr_id, propertyname, propertyvalue) values (101,'facet','field1');

JSP Related Changes for displaying facet in Store

Add the facet to the storefront  so that the Madisons storefront to display the facet data in the left sidebar.

Navigate to Stores>WebContent>Madisons>Snippets>ReusableObjects and open the file SearchFacetsDisplay.jspf. This JSP fragment loops through the available global facets and includes another JSP fragment to display each facet’s data. You will create the new JSP fragment for field1 in a later step.

Add a new test into the <c:choose> block to look for the field1 facet and include its display JSP fragment. You can copy one of the existing <c:when> blocks and update it to match the screen capture below.

<c:when test=”${facetField.value eq ‘field1’}”>
 <%@ include file=”../../ Field1FacetDisplay.jspf”%>
 <c:set var=”f” value=”$(f+1}”/>
</when>

Navigate to Stores > WebContent > Madisons > Snippets > Search.
Make a copy of the file  BrandFacetDisplay.jspf and call the new file Field1FacetDisplay.jspf.

Open Field1FacetDisplay.jspf. Remove   the below line starts with

<span class =left_sidebar_header”> <fmt:message key="SEARCH_FACET_MANUFACTURER" bundle="${storeText}"/></span>
Add the below line
<span class =left_sidebar_header”> Shopper points</span>

Management Center changes

1.Login into Management Center
2.Select the Madisons store.
3.Expand the master catalog and select the Coffee Tables category to display the catalog entries list.
4.Select catalog entry
5.Choose configure columns
6.Select field1,and assign some value so that it will come in facets
7.Do the same for other catalog entries

Thursday, March 29, 2018

EJB Bean and table relation in ibm wcs

Some time i want to see custome access bean belongs to which table.

You search for map.mapxmi this file have linking og table with bean.


For OOB beans refer below URL :

Cross-reference of data beans, EJB beans, and tables

Wednesday, March 21, 2018

IBM WCS Toolkit - java.lang.ClassNotFoundException: com.ibm.db2.jcc.am.SqlDataException



ISSUE:
Frist time after starting WCS V8, I hit store URL and i got below exception:
The exception seems to derive from the class: com.ibm.commerce.foundation.server.command.bod.BusinessObjectDocumentProcessor
In particular, this class makes a check about the existing masked exceptions; the list of values of the masked exceptions is contained in the following file:
 IBM\WCDE80\workspace\WC\xml\config\com.ibm.commerce.foundation\wc-component.xml
<_config:configgrouping name="BusinessObjectDocumentProcessor">
    <_config:property name="maskedExceptionClassList" value="java.sql.SQLException,com.ibm.db2.jcc.am.SqlDataException,com.ibm.commerce.foundation.server.services.dataaccess.exception.QueryServiceSystemException"/>
</_config:configgrouping>
The above code contains- in the maskedExceptionClassList property- the class com.ibm.db2.jcc.am.SqlDataException.
 However, the system is not using DB2 but Oracle, so it's pretty normal an exception is thrown and the class is not found.


[3/21/18 12:02:57:315 IST] 000000f6 BusinessObjec W com.ibm.commerce.foundation.server.command.bod.BusinessObjectDocumentProcessor static com.ibm.db2.jcc.am.SqlDataException
                                 java.lang.ClassNotFoundException: com.ibm.db2.jcc.am.SqlDataException
 at java.lang.Class.forNameImpl(Native Method)
 at java.lang.Class.forName(Class.java:256)
 at com.ibm.commerce.foundation.server.command.bod.BusinessObjectDocumentProcessor.<clinit>(BusinessObjectDocumentProcessor.java:141)
 at java.lang.J9VMInternals.initializeImpl(Native Method)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
 at com.ibm.commerce.catalog.facade.server.CatalogFacadeImpl.getCatalog(CatalogFacadeImpl.java:56)
 at com.ibm.commerce.catalog.facade.server.EJSLocalStatelessCatalog_867afe99.getCatalog(EJSLocalStatelessCatalog_867afe99.java:845)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
 at java.lang.reflect.Method.invoke(Method.java:620)
 at com.ibm.commerce.foundation.internal.client.services.invocation.impl.LocalEJBInvocationBindingImpl.invoke(LocalEJBInvocationBindingImpl.java:211)
 at com.ibm.commerce.foundation.internal.client.services.invocation.InvocationService.invoke(InvocationService.java:113)
 at com.ibm.commerce.foundation.client.facade.bod.AbstractBusinessObjectDocumentFacadeClient.internalSendBusinessObjectDocument(AbstractBusinessObjectDocumentFacadeClient.java:813)
 at com.ibm.commerce.foundation.client.facade.bod.AbstractBusinessObjectDocumentFacadeClient.sendBusinessObjectDocument(AbstractBusinessObjectDocumentFacadeClient.java:529)
 at com.ibm.commerce.catalog.facade.client.AbstractCatalogFacadeClient.getCatalog(AbstractCatalogFacadeClient.java:186)
 at com.ibm.commerce.catalog.facade.client.AbstractCatalogFacadeClient.getCatalog(AbstractCatalogFacadeClient.java:371)
 at com.ibm.commerce.catalog.facade.client.AbstractCatalogFacadeClient.getCatalog(AbstractCatalogFacadeClient.java:397)
 at com.ibm.commerce.catalog.facade.server.cache.DefaultCatalogCache$MyDefaultCatalogCacheableDataAndDependencyIdGenerator.generateCacheableData(DefaultCatalogCache.java:117)
 at com.ibm.commerce.datatype.AbstractFinderResult.invokeFinder(AbstractFinderResult.java:622)
 at com.ibm.commerce.datatype.CacheableFinderResult.invokeFinder(CacheableFinderResult.java:195)
 at com.ibm.commerce.dynacache.commands.AbstractFinderResultCache.myInvokeFinder(AbstractFinderResultCache.java:1526)
 at com.ibm.commerce.dynacache.commands.AbstractFinderResultCache.invokeFinder(AbstractFinderResultCache.java:1161)
 at com.ibm.commerce.dynacache.commands.AbstractDistributedMapCache$Cache.getOrPut(AbstractDistributedMapCache.java:520)
 at com.ibm.commerce.dynacache.commands.AbstractDistributedMapCache$Cache.access$3(AbstractDistributedMapCache.java:507)
 at com.ibm.commerce.dynacache.commands.AbstractDistributedMapCache.getOrPut(AbstractDistributedMapCache.java:285)
 at com.ibm.commerce.catalog.facade.server.cache.DefaultCatalogCache.getDefaultCatalogId(DefaultCatalogCache.java:168)
 at com.ibm.commerce.catalog.facade.server.helpers.CatalogComponentHelper.getDefaultCatalogId(CatalogComponentHelper.java:6272)
 at com.ibm.commerce.seo.registry.SEOConfigurationRegistry.populateStoreUrlKeywords(SEOConfigurationRegistry.java:552)
 at com.ibm.commerce.seo.registry.SEOConfigurationRegistry.initialize(SEOConfigurationRegistry.java:306)
 at com.ibm.commerce.seo.registry.SEOConfigurationRegistry.initializeRegistry(SEOConfigurationRegistry.java:1644)
 at com.ibm.commerce.seo.registry.SEOConfigurationRegistry.singleton(SEOConfigurationRegistry.java:843)
 at com.ibm.commerce.seo.url.helpers.SEOURLMapperImpl.getStoreIdFromSEOURL(SEOURLMapperImpl.java:1636)
 at com.ibm.commerce.seo.url.helpers.SEOURLMapperImpl.processRequestURL(SEOURLMapperImpl.java:1743)
 at com.ibm.commerce.webcontroller.RuntimeServletFilter.doFilterAction(RuntimeServletFilter.java:647)
 at com.ibm.commerce.webcontroller.RuntimeServletFilter.access$0(RuntimeServletFilter.java:614)
 at com.ibm.commerce.webcontroller.RuntimeServletFilter$1.run(RuntimeServletFilter.java:458)
 at com.ibm.commerce.webcontroller.RuntimeServletFilter.doFilter(RuntimeServletFilter.java:500)
 at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
 at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
 at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3926)
 at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
 at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
 at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
 at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)
 at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:643)
 at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
 at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
 at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
 at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
 at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
 at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
 at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
 at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)

 Resolution:
1) edit the file
  --> IBM\WCDE80\workspace\WC\xml\config\com.ibm.commerce.foundation\wc-component.xml
 and change the property maskedExceptionClassList with the following value:
 java.sql.SQLException,com.ibm.commerce.foundation.server.services.dataaccess.exception.QueryServiceSystemException

 After change value:

  <_config:configgrouping name="BusinessObjectDocumentProcessor">
   <_config:property name="maskedExceptionClassList" value="java.sql.SQLException,com.ibm.commerce.foundation.server.services.dataaccess.exception.QueryServiceSystemException"/>
  </_config:configgrouping>

 2) restart the test server

Monday, February 12, 2018

CreateKeyException in ibm wcs

"com.ibm.commerce.key.CreateKeyException: unexpected error - no row in keys table for XTABLE"

This issue mostly happens when in you bean class e.g. TableBeam - EjbCreate method using table name in capital and in KEYS table TABLE name is in small.

Solution : Eighter update bean with small letters as you have in keys table or Update KEYS table with table name you have in bean class.