Monday, August 26, 2024
disable access control policy in HCL WCS
Tuesday, February 21, 2023
HCL Commerce ACP policy
MERGE
INTO
ACRESCGRY acresgry
USING
(
SELECT ACRESCGRY_ID, RESCLASSNAME FROM (
SELECT (SELECT MAX(ACRESCGRY_ID)+1 FROM acrescgry) ACRESCGRY_ID, 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd' RESCLASSNAME FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresgry.RESCLASSNAME = t.RESCLASSNAME
)
WHEN MATCHED THEN
UPDATE SET
acresgry.RESCLASSNAME = t.RESCLASSNAME
WHEN NOT MATCHED THEN
INSERT (acresgry.ACRESCGRY_ID, acresgry.RESCLASSNAME)
VALUES (t.ACRESCGRY_ID, t.RESCLASSNAME)
;
MERGE
INTO
ACRESACT acresact
USING
(
SELECT ACRESCGRY_ID, ACACTION_ID FROM (
SELECT (SELECT ACRESCGRY_ID FROM acrescgry where RESCLASSNAME like 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd') ACRESCGRY_ID, (SELECT ACACTION_ID FROM acaction where action = 'Execute') ACACTION_ID FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresact.ACRESCGRY_ID = t.ACRESCGRY_ID and acresact.ACACTION_ID = t.ACACTION_ID
)
WHEN NOT MATCHED THEN
INSERT (acresact.ACRESCGRY_ID, acresact.ACACTION_ID)
VALUES (t.ACRESCGRY_ID, t.ACACTION_ID)
;
MERGE
INTO
ACRESGPRES acresgpres
USING
(
SELECT ACRESGRP_ID, ACRESCGRY_ID FROM (
SELECT (SELECT ACRESGRP_ID FROM ACRESGRP where GRPNAME = 'RegisteredUserCmdResourceGroup') ACRESGRP_ID , (SELECT ACRESCGRY_ID FROM acrescgry where RESCLASSNAME like 'com.XYX.commerce.usermanagement.commands.XYZProfileTypeCmd') ACRESCGRY_ID FROM SYSIBM.SYSDUMMY1
)
) t
ON
(
acresgpres.ACRESGRP_ID = t.ACRESGRP_ID and acresgpres.ACRESCGRY_ID = t.ACRESCGRY_ID
)
WHEN NOT MATCHED THEN
INSERT (acresgpres.ACRESGRP_ID , acresgpres.ACRESCGRY_ID)
VALUES (t.ACRESGRP_ID, t.ACRESCGRY_ID )
;
Wednesday, December 28, 2022
java was started but returned exit code=-805306369
Issue : java was started but returned exit code = -805306369 C:\Windows\System32\javaw.exe -jar C:\Program Files\Java\eclipse-jee-helios-SR2-win32-x86_64\eclipse\plugins\org.eclipse.equinox.launcher_1.11.1.R36x_v20101122_1400.jar
Resolution : Update eclipe.ini file located in C:\IBM\SDP. Update below 2 highlighted value
-Dorg.eclipse.swt.browser.IEVersion=11001
-Xquickstart
-Xms1024m
-Xmx1536m
-Xmnx64m
-XX:MaxPermSize=1024M
Monday, July 5, 2021
SonarQube Setup Guide
SonarQube Setup Guide
Download the SonarQube Community Edition
Note : SonarQube requires disk space of around 100 GB.
2. Unzip it, let's say in C:\sonarqube or /etc/sonarqube.
3. Install java 11 and set the path.
4. Edit the wrapper.conf file from the sonar and set the path location of java.
5. Start the SonarQube Server.
6. Log in to http://localhost:9000 with System Administrator credentials (admin/admin)
7. Download sonar scanner from the given link. SonarScanner | SonarQube Docs
8. Create sonar-project.properties file in the project folder which is to be scanned and configure the project properties.
9. Set user variable for the sonar scanner.
10. Run sonar-scanner.bat command on command prompt from the project folder.
11. Log in to http://localhost:9000 with System Administrator credentials (admin/admin) to check the scan results.
REFERENCES:
https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/installation-and-configuration.md#:~:text=In%20the%20extracted%
20folder%20navigate,the%20currently%20in%20use%20ports.
Wednesday, June 9, 2021
Adding trace in ts-app container in HCL commerce
Adding new trace from ts-app container : Execute you container then from there run :
Wednesday, January 27, 2021
Installing NetBeans12.2
Download NetBeans : https://www.apache.org/dyn/closer.cgi/netbeans/netbeans/12.2/Apache-NetBeans-12.2-bin-windows-x64.exe
open NetBeans installer location in command prompt and type: netbeans*****.exe --javahome "C:\Program Files\Java\jdk"
e.g. C:\Users\Documents\>Apache-NetBeans-12.2-bin-windows-x64.exe --javahome "C:\Program Files (x86)\Java\jdk1.8.0_281"
Tuesday, December 15, 2020
Input validation of number in JSP
As per one security flaw in security scan Input Validation : We have to validate input is number or not .
Use below code for same
<jsp:forward page="AccessError.jsp">
<jsp:param name="storeId" value="${WCParam.storeId}" />
<jsp:param name="langId" value="${WCParam.langId}" />
<jsp:param name="catalogId" value="${WCParam.catalogId}" />
</jsp:forward>
Solution used was:
<c:set var="storeId"> <c:if test="${WCParam.storeId.matches('[0-9]+')}">
<c:out value="${WCParam.storeId}"/>
</c:if></c:set>
Thursday, August 20, 2020
RestTemplate to POST with UTF-8 encoding
Sometime we see extra character in rest response like Â, â. To overcome this issue We need to add StringHttpMessageConverter to rest template's message converter with charset UTF-8. Like below
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters()
.add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8));
Refer : UTF encoding from rest response
Saturday, July 18, 2020
msgtypes related tables in WCS
select * from profile
select * from iseditatt
select * from cseditatt
Friday, May 1, 2020
WCS Useful loggers
Struts
REST
Search in WAS
JPA
*=info:JPA=all:openjpa.*=finer:openjpa.kernel=finest
SQL
com.ibm.ws.rsadapter.jdbc.WSJdbcStatement=finer:
com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement=finer:
com.ibm.ws.rsadapter.jdbc.WSJccCallableStatement=finer:
com.ibm.ws.rsadapter.jdbc.WSJccStatement=finer:
com.ibm.ws.rsadapter.jdbc.WSJccPreparedStatement=finer
com.ibm.commerce.component.helper.*=all:com.ibm.commerce.component.registry.*=all:com.ibm.commerce.foundation.logging.*=all
Thursday, April 9, 2020
Decrypt AES encrypted Password in WCS
package com.xyz.commerce.me.datatype;
import com.ibm.commerce.ejb.helpers.nc_crypt;
import com.ibm.commerce.util.wrapper.AES128Cryptx;
public class test {
public static void main(String[] args) throws Exception {
System.out.println("merchantKey ");
String key = "PxrEn69MEqvE4rGLFnQoxZl6VAbbxVvQp2bPrDKxAYX=";
System.out.println("str length " + key.length());
//TO decrypt merchent key in CustomKeys.xml
String keyFileValue = "HuRIPYJ92f5mf1iMUDqTLivbros95jcCNTWSjcgDh/dCbdAn9LR+JEEn7X3PsHkhUk+zl6XhSU2rH0RtwKBgwg=="; //value present in keyFile file.
String KeyEncryptionFileValue= "1234567890abcdef1234567890abcdef"; //Value present in keyEncryptionFile file.
String decryptedMerchantKey = AES128Cryptx.decrypt(keyFileValue,KeyEncryptionFileValue, false) ;
//Printing decrypted merchant Key
System.out.println("Decrypted Merchant Key : " + decryptedMerchantKey);
String stringToDecrypt = "PxrEn69MEqvE4rGLFnQoxZl6VAbbxVvQp2bPrDKxANM=";//String to decrypt
//printing decrypted password using merchant key
System.out.println("Decrypted String : " + AES128Cryptx.decrypt(stringToDecrypt,decryptedMerchantKey,false));
}
}
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
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
I am getting below issue while server startup.
Tuesday, October 16, 2018
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
Monday, July 9, 2018
SRVE0216E: post body contains less bytes than specified by content-length
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
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.