Tuesday, 17 January 2017

Java Character Convertion to Unicode with native2ascii Utility

While working on multi language assignment found interesting JAVA utility.

native2ascii : Converts a file with ‘non-Latin 1’ or ‘non-Unicode’ characters to ‘Unicode-encoded’ characters.

Sometimes you need this kind of conversion. As in our case we need this to create multi language  resource bundles. 

Here are the steps :

1. Create file [Resource_Original.properties in our case] and save as UTF-8 format [This option is available in popular editors like NotePad++].

===================================================================
login=Bejelentkezés
personalInformation=Személyes információ
orderHistory=Rendelés történet
paymentInformation=Fizetség információ
===================================================================

2. Now use native2ascii command to convert it into Unicode format.

 native2ascii -encoding UTF-8 Resource_Original.properties Resource_converted.properties

3. Check the converted file [Resource_converted.properties]. 

=================================================================== 
login=Bejelentkez\u00e9s
personalInformation=Szem\u00e9lyes inform\u00e1ci\u00f3
orderHistory=Rendel\u00e9s t\u00f6rt\u00e9net
paymentInformation=Fizets\u00e9g inform\u00e1ci\u00f3
===================================================================

Friday, 6 January 2017

Oracle Database Connectivity Issue | ORA-17002 IO Error : Socket read timed out

While connecting oracle database with SQL Developer got below error.

ORA-17002 IO Error: Socket read timed out


After analysis found that listener was down. Here are steps to analyze and fix this.

1. Go to ORACLE_HOME/bin and check listener status using lsnrctl status command. It will show below message.
=======================================================================
[root@dev bin]# ./lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-JAN-2017 18:42:11

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused


=======================================================================

2. Now start the listener using lsnrctl start command.

=======================================================================
 [oracle@dev bin]$ ./lsnrctl start

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-JAN-2017 18:55:16

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting /app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /app/oracle/diag/tnslsnr/dev/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                 TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date             06-JAN-2017 18:55:18
Uptime                  0 days 0 hr. 0 min. 0 sec
Trace Level           off
Security                ON: Local OS Authentication
SNMP                   OFF
Listener Parameter File   /app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/dev/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully


=======================================================================

3. Now you can confirm listener status again using lsnrctl status command.

=======================================================================
 [oracle@dev bin]$ ./lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 06-JAN-2017 18:55:42

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                 TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date             06-JAN-2017 18:55:18
Uptime                  0 days 0 hr. 0 min. 24 sec
Trace Level          off
Security               ON: Local OS Authentication
SNMP                  OFF
Listener Parameter File   /app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/dev/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/app/oracle/product/12.1.0/dbhome_1/admin/dev/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "localhost" has 1 instance(s).
  Instance "dev", status READY, has 1 handler(s) for this service...
Service "devXDB.dev.local" has 1 instance(s).
  Instance "dev", status READY, has 1 handler(s) for this service...
The command completed successfully


=======================================================================

Note : To perform this activity you should login as non root user.

Sunday, 25 December 2016

Endeca | Add a new site to an existing application

You can easily add new site to existing endeca application by following below steps.

Nature

1. Export the application you want to modify (Add a site).
   a. Navigate to application control directory.
   b. Invoke this command to export application.
        runcommand.<bat|sh> IFCR exportApplication <destination directory>
   c.  Navigate to destination directory and unzip the exported zip file.

2. Add the default site ID, site node and site definition for you new site.
  a. Navigate to the pages node(directory) of your unzipped exported application. 
  b. Open the _.json file in an editor and add a default site ID.
      For example:
      {
         "defaultSiteId": "/TestStoreDE",
         "ecr:type": "page-root"
      }
  c) Navigate to the <export directory>\pages directory. Note that the application already has an
      existing site. For example, the Store application has an existing site with TestStoreUS as the
      site_ID.
  d) Create a folder for your new site parallel to the existing site. The name that you provide for the folder
       becomes the site_ID, for example
TestStoreDE.
  e) Navigate to the existing site in your application, for example pages\
TestStoreUS.
  f) Copy the site definition file, _.json, from the folder and paste it into your new site folder, for example
      pages\
TestStoreDE\_.json.
  g) Use a text editor to update the site definition with unique information appropriate for your new site. For example, the following new site has been updated with a unique URL pattern, display name, and
      description.
      {
          "ecr:type": "site-home",
          "urlPattern" : "/
TestStoreDE",
          "displayName" : "German Store",
          "description" : "This is German Store",
      }

  h) If you want the site to have its own unique icon to identify it in Experience Manager, you can replace
      the default site icon with one of your own by copying an image to the same directory as the site's
      JSON file.The image must be 16 by 16 pixels, and be named siteIcon.<extension>, for example
      pages\TestStoreDE\siteIcon.png. The supported formats are JPG, JPEG, PNG, GIF, and TIF.         Oracle recommends using the PNG format.
  i) Save and close the file.

3. If you want your site to filter a subset of relevant records, you need to add a site-based filter to your site.
    a) Navigate to the new site directory pages/<new site_ID>, for example pages/TestStoreDE.
    b) Create an XML file and name it filterState.xml. The following file filters records so that only those
         records in the furniture category can appear in the site.
          <Item class="com.endeca.infront.navigation.model.FilterState"
                     xmlns="http://endeca.com/schema/xavia/2010">
                   <Property name="recordFilters">
                     <List>
                          <String>product.category:furniture</String>
                     </List>
                   </Property>
          </Item>
   c) Save and close the file.
4. A site needs at least one page in order to display so copy and paste pages that you want from your original site to your new site.
For example, you could copy the browse or account folder from pages/TestStoreUS to pages/TestStoreDE.
5. Import the content with the new site information.
   a. Navigate to application control directory.
   b. Invoke this command to import updated application.
       runcommand.<bat/sh> IFCR importContent pages <path to source>.

Saturday, 24 December 2016

Endeca Baseline Error on Linux VM | Can't locate strict.pm in @INC

While running baseline on new Endeca application got below error.

Error : Can't locate strict.pm in @INC (@INC contains <path to some perl directories>)

Can't Locate

Solution :

1. Run below commands.

export PERLLIB=$ENDECA_ROOT/lib/perl:$ENDECA_ROOT/lib/perl/Control:$ENDECA_ROOT/perl/lib:$ENDECA_ROOT/perl/lib/site_perl
export PERL5LIB=$ENDECA_ROOT/lib/perl:$ENDECA_ROOT/lib/perl/Control:$ENDECA_ROOT/perl/lib:$ENDECA_ROOT/perl/lib/site_perl

2. Restart PlatformServices and trigger indexing again.

Note : Set ENDECA_ROOT properly before running this command.

Wednesday, 7 December 2016

ATG 11.2 BCC Full Deployment ConcurrentUpdateException

While running full deployment on ATG 11.2 first time it failed due to below exception.

============================================================================
2016-12-06 19:25:53,345 ERROR [STDERR] (RepositoryWorkerThread-1(Add-Update Phase)) atg.repository.ConcurrentUpdateException: no rows updated oldVersion=36 for item=deploymentProgress:1100003 in GSATransaction=atg.adapter.gsa.GSATransaction@1890638 thread=RepositoryWorkerThread-1(Add-Update Phase) transaction=TransactionImple < ac, BasicAction: aaf04af:134f:4e650790:b4cf status: ActionStatus.RUNNING >
============================================================================

Solution : Run full deployment with DeploymentManager.maxThreads=1 configuration.

Step 1 : Open the dyn/admin of BCC instance.
Step 2 : Open DeploymentManager component.
Step 3 : Update maxThreads property to 1.
Step 4 : Run full deployment again.

Saturday, 12 November 2016

MDEX Performance boost | Increase Number of threads

MDEX engine can be configured to run in multi threaded mode. By default MDEX runs in multi threaded mode only with number of threads configured to 1. Multi threaded mode cannot be disabled.

Engine 
How to configure [increase] number of threads : Number of threads are controlled with --threads flag. Specify the --threads flag when starting the MDEX Engine. Or you can mention same in MDEX configuration xml file. For example

 <arg>--threads</arg>
      <arg>2</arg>

 
Key benefits of multi threaded MDEX engine.

Large index files on disk : Single index files are shared between all the threads.
Long-running queries   : Some of thread responds to long running queries while others can respond to different queries.
Simplified system management and network architecture : Need to configure only single MDEX engine.
Applications with high throughput requirements with limited hardware resources : Fewer hard ware resources required than multiple single threaded MDEX engines.
Applications that heavily use the MDEX Engine dynamic cache : Threads in multi threaded MDEX shares the same dynamic cache.

Note : Recommended number of threads for the MDEX Engine is typically equal to the number
of cores on the MDEX Engine server.

Wednesday, 12 October 2016

ATG | Persist price information for incomplete orders

By default ATG won't persists price information for incomplete orders. If you print incomplete order from dyn/admin, you won't get price information.

Incomplete Order without price information :
========================================================================= 
------ Printing item with id: o120001 
<add-item item-descriptor="order" id="o120001"> 
<set-property name="description"><![CDATA[o120001]]></set-property> 
<set-property name="relationships"><![CDATA[r30001]]></set-property> 
<set-property name="commerceItems"><![CDATA[ci3000001]]></set-property
<set-property name="shippingGroups"><![CDATA[sg120001]]></set-property>
<set-property name="profileId"><![CDATA[260000]]></set-property> 
<set-property name="siteId"><![CDATA[homeSite]]></set-property> 
<set-property name="orderClassType"><![CDATA[default]]></set-property>
<set-property name="creationSiteId"><![CDATA[homeSite]]></set-property>
<set-property name="creationDate"><![CDATA[10/12/2016 22:50:01]]></set-property>
<set-property name="paymentGroups"><![CDATA[pg120001]]></set-property>
</add-item>
=========================================================================

To achieve this update orderStateSaveModes (Order state to save mode mapping) property of /atg/commerce/order/processor/SavePriceInfoObjects/ processor [add mapping for INCOMPLETE order].

Example Mapping :

INCOMPLETE=ALL

The valid save modes are :
  • ALL : Saves all PriceInfo types.
  • ALL_NO_AUDIT : Saves all PriceInfo types, but does not save audit trail information (pricing adjustments and detailed price info objects).
  • ORDER : Saves only the OrderPriceInfo object (not shipping, item, tax).
  • ORDER_NO_AUDIT : Saves only the OrderPriceInfo object, with no audit information.
  • NONE : Saves no pricing information.
ProcSavePriceInfoObjects also includes a defaultSaveMode to use if the current order state does not have an entry in the orderStateSaveModes map.

Incomplete Order with price information (post above configuration change) :
=========================================================================
------ Printing item with id: o120001 
<add-item item-descriptor="order" id="o120001"> 
<set-property name="description"><![CDATA[o120001]]></set-property> 
<set-property name="relationships"><![CDATA[r30001]]></set-property> 
<set-property name="commerceItems"><![CDATA[ci3000001]]></set-property>
<set-property name="shippingGroups"><![CDATA[sg120001]]></set-property>
<set-property name="profileId"><![CDATA[260000]]></set-property>  
<set-property name="siteId"><![CDATA[homeSite]]></set-property> 
<set-property name="orderClassType"><![CDATA[default]]></set-property> 
<set-property name="creationSiteId"><![CDATA[homeSite]]></set-property> 
<set-property name="taxPriceInfo"><![CDATA[ai10005]]></set-property>
<set-property name="creationDate"><![CDATA[10/12/2016 22:50:01]]></set-property>
<set-property name="priceInfo"><![CDATA[ai10001]]></set-property> 
<set-property name="paymentGroups"><![CDATA[pg120001]]></set-property> 
</add-item>
=========================================================================