Wednesday, April 8, 2020

ADMA5014E - The installation of application WC failed



Sometime while doing server clean we are getting below exception :

[4/6/20 13:22:32:576 EDT] 00000099 UninstallSche I   ADMA5017I: Uninstallation of WC started.
[4/6/20 13:23:04:849 EDT] 00000099 UninstallSche I   ADMA5106I: Application WC uninstalled successfully.
[4/6/20 13:25:06:174 EDT] 000000ac InstallSchedu I   ADMA5016I: Installation of WC started.
[4/6/20 13:26:03:189 EDT] 000000ac FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\IBM\WCDE_V9\wasprofile\logs\ffdc\server1_a33aa440_20.04.06_13.26.02.9397908970630759559988.txt com.ibm.ws.management.application.task.ConfigureTask.performTask 481
[4/6/20 13:26:03:283 EDT] 000000ac FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\IBM\WCDE_V9\wasprofile\logs\ffdc\server1_a33aa440_20.04.06_13.26.03.2214555710547160290204.txt com.ibm.ws.management.application.task.ConfigureTask.performTask 494
[4/6/20 13:26:03:408 EDT] 000000ac InstallSchedu I   ADMA5014E: The installation of application WC failed.
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveWrappedException
Stack trace of nested exception:
org.eclipse.jst.j2ee.commonarchivecore.internal.exception.NoModuleFileException: A file does not exist for module element having uri: Stores.war
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.checkType(ModuleRefImpl.java:591)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.initModuleFileFromEAR(ModuleRefImpl.java:167)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getModuleFile(ModuleRefImpl.java:120)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getModuleFile(EARFileImpl.java:175)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getDeploymentDescriptor(EARFileImpl.java:851)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getDeploymentDescriptor(ModuleRefImpl.java:230)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getDeploymentDescriptor(ModuleRefImpl.java:223)
at com.ibm.ws.management.application.task.ConfigureTask.getModuleNameFromModuleRef(ConfigureTask.java:2056)
at com.ibm.ws.management.application.task.ConfigureTask.createMDsForModuleRefs(ConfigureTask.java:1258)
at com.ibm.ws.management.application.task.ConfigureTask.createMDsIfNeeded(ConfigureTask.java:1095)
at com.ibm.ws.management.application.task.ConfigureTask.reconcileModuleDeployment(ConfigureTask.java:994)
at com.ibm.ws.management.application.task.ConfigureTask.performTask(ConfigureTask.java:375)
at com.ibm.ws.management.application.SchedulerImpl.run(SchedulerImpl.java:315)
at java.lang.Thread.run(Thread.java:812)

[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R Stack trace of nested exception:
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R org.eclipse.jst.j2ee.commonarchivecore.internal.exception.NoModuleFileException: A file does not exist for module element having uri: Stores.war
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.checkType(ModuleRefImpl.java:591)
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.initModuleFileFromEAR(ModuleRefImpl.java:167)
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getModuleFile(ModuleRefImpl.java:120)
[4/6/20 13:26:03:299 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getModuleFile(EARFileImpl.java:175)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getDeploymentDescriptor(EARFileImpl.java:851)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getDeploymentDescriptor(ModuleRefImpl.java:230)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleRefImpl.getDeploymentDescriptor(ModuleRefImpl.java:223)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.task.ConfigureTask.getModuleNameFromModuleRef(ConfigureTask.java:2056)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.task.ConfigureTask.createMDsForModuleRefs(ConfigureTask.java:1258)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.task.ConfigureTask.createMDsIfNeeded(ConfigureTask.java:1095)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.task.ConfigureTask.reconcileModuleDeployment(ConfigureTask.java:994)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.task.ConfigureTask.performTask(ConfigureTask.java:375)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at com.ibm.ws.management.application.SchedulerImpl.run(SchedulerImpl.java:315)
[4/6/20 13:26:03:314 EDT] 000000ac SystemErr     R at java.lang.Thread.run(Thread.java:812)
[4/6/20 13:26:37:750 EDT] 00000089 AppBinaryProc I   ADMA7021I: Distribution of application WC completed successfully.

Solution :
1. Right click on WC project and select properties --> Select Deployment Assembly

2. You may see Store is not there or may be there in both case remove Stores and re-add that
3.Select project

 4. select stores in project and finish.



Decrypt IBM WCS encrypted key

Decrypt IBM WCS encrypted key


package com.xyz.commerce.tools.devtools.flexflow.taglibs;

import com.ibm.commerce.ejb.helpers.nc_crypt;

public class TEST {
public static void main(String[] args) {

String merchantKey = nc_crypt.decrypt(
"ldbrNlajddp8od+xZpJDiK/DbuVqOEE+", null);

System.out.println("merchantKey         " + merchantKey);

String keyToDecrypt = "gpJMgIorXCz/1yTeFHiEcDPWJYv7NmRQ";
System.out.println("Decrypted String : "
+ nc_crypt.decrypt(keyToDecrypt , merchantKey ));

}
}

Wednesday, March 11, 2020

DB2 connection problem in WebSphere

DB2 connection problem in WebSphere

I am getting below issue while server startup.

DSConfigHelpe W   DSRA8200W: DataSource Configuration: DSRA8020E: Warning: The property 'connectionAttribute' does not exist on the DataSource class com.ibm.db2.jcc.DB2ConnectionPoolDataSource.

com.ibm.commerce.wc.appmanagement.exception.WCAppManagementException: com.ibm.websphere.ce.cm.StaleConnectionException: [jcc][t4][10380][11951][4.19.66] Required property "mydbhost.com" is unknown host. ERRORCODE=-4222, SQLSTATE=08001 DSRA0010E: SQL State = 08001, Error Code = -4,222



Solution : Please check hostname used in resources.xml and wc-server.xml files are correct. 
WCDE_V9\workspace\WC\META-INF\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\resources.xml

<resourceProperties description="The name of the server, used with thin driver setup" name="serverName" required="false" type="java.lang.String" value="mydbhost.com" xmi:id="J2EEResourceProperty_1123801797694"/>

After updating value, Please restart server.

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.