Friday, February 28, 2014

Struts actions AjaxComponentServiceAction !!

   
This is not your usual forward mapping to a JSP or an action mapping to a command
 This is an example of calling a component service from an ajax style request and this must be define a struts action in struts-config-ext.xml. Plese find below a snippet.

   <action parameter="member.updateAddressForPerson" path="/AjaxPersonChangeServiceAddressUpdate" type="com.ibm.commerce.struts.AjaxComponentServiceAction">
            <set-property property="authenticate" value="0:0"/>
            <set-property property="https" value="0:0"/>
            <set-property property="csrfProtected" value="0:0"/>
        </action>

e.g. Service actions above can be used in refresh areas example below. After completion of the command, the struts action forwards the JSP file  that generates a JSON , with response property containing success or failure details.

    wc.service.declare({
        id: "AjaxUpdateAddressForPerson",
        actionId: "AjaxUpdateAddressForPerson",
        url: getAbsoluteURL() + "AjaxPersonChangeServiceAddressUpdate",
        formId: ""

    /**
     * hides all the messages and the progress bar
     * @param (object) serviceResponse The service response object, which is the
     * JSON object returned by the service invocation
     */
        ,successHandler: function(serviceResponse) {
            AddressHelper.updateOrderAfterAddressUpdate();
            MessageHelper.hideAndClearMessage();
            cursor_clear();
        }
     /**
     * display an error message
     * @param (object) serviceResponse The service response object, which is the
     * JSON object returned by the service invocation
     */
        ,failureHandler: function(serviceResponse) {

            if (serviceResponse.errorMessage) {
                MessageHelper.displayErrorMessage(serviceResponse.errorMessage);
            }
            else {
                 if (serviceResponse.errorMessageKey) {
                    MessageHelper.displayErrorMessage(serviceResponse.errorMessageKey);
                 }
            }
            cursor_clear();
        }

    }),

Reference: For more information on checkout controls, please review IBM infocenter.

Sunday, February 9, 2014

IP address change | could cause staleConnectionException wiith remote DB

If you guys have worked with DB2 from VM. This could happen from periodically. Just be vary to uncatalog and catalog with the new IP address.

[12:44:55:179 EDT] 0000000c SystemOut     O WC.TOOLKIT: Enterprise 7.0.0.6 /
[12:44:55:170 EDT] 0000000c SystemErr     R com.ibm.commerce.wc.appmanagement.exception.WCAppManagementException: com.ibm.websphere.ce.cm.StaleConnectionException: [jcc][t4][2055][11259][4.13.80] The database manager is not able to accept new requests, has terminated all requests in progress,
or has terminated this particular request due to unexpected error conditions detected at the target system.
ERRORCODE=-4499, SQLSTATE=58009DSRA0010E: SQL State = 58009, Error Code = -4,499
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.wc.version.ECDatabaseVersionInfo.readSiteTable(ECDatabaseVersionInfo.java:140)
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.wc.version.ECDatabaseVersionInfo.(ECDatabaseVersionInfo.java:84)
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.server.ProductInfo.getECDatabaseVersionInfo(ProductInfo.java:58)
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.server.ProductInfo.getECDBVersionInfo(ProductInfo.java:96)
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.server.ProductInfo.getProductVersion(ProductInfo.java:75)
[12:44:55:171 EDT] 0000000c SystemErr     R     at com.ibm.commerce.server.WcsApp.configInit(WcsApp.java:718)
[12:44:55:172 EDT] 0000000c SystemErr     R     at com.ibm.commerce.server.WcsApp.initialize(WcsApp.java:454)


Commands to uncatalog and catalog in DB2:

db2 UNCATALOG DATABASE
db2 UNCATALOG NODE
db2 catalog tcpip node remote 144.149.XX.X server 50000
db2 catalog database as at node
db2 terminate


EJB adding a resource reference in toolkit | JDE Integration

Adding a resource reference is required for multiple purposes and one example would for JDE Integration.
When you need to connect to a third party or external resource. Click the deployment descriptor the EJB project and goto the references tab and click add reference.













A resource is created ejb-jar.xml block and a resource is created ibm-ejb-jar-bnd.xmi: