Saturday, 13 June 2015

Resolving 'ConfigurationGeneratorForge' failed Issue

Endeca baseline indexing failed for newly created application. 


Here is the baseline error detail.

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

C:\Endeca\apps\Store\control>baseline_update.bat
[06.13.15 19:35:25] INFO: Checking definition from AppConfig.xml against existing EAC provisioning.
[06.13.15 19:35:26] INFO: Updating provisioning for component 'ConfigurationGeneratorForge'.
[06.13.15 19:35:26] INFO: Updating definition for component 'ConfigurationGeneratorForge'.
[06.13.15 19:35:27] INFO: Updating provisioning for component 'Forge'.
[06.13.15 19:35:27] INFO: Updating definition for component 'Forge'.
[06.13.15 19:35:27] INFO: Updating provisioning for component 'PartialForge'.
[06.13.15 19:35:27] INFO: Updating definition for component 'PartialForge'.
[06.13.15 19:35:27] INFO: Definition updated.
[06.13.15 19:35:27] INFO: Starting baseline update script.
[06.13.15 19:35:27] INFO: Acquired lock 'update_lock'.
[06.13.15 19:35:27] INFO: [ITLHost] Starting shell utility 'cleanDir_processing'.
[06.13.15 19:35:29] INFO: [ITLHost] Starting shell utility 'cleanDir_forge-output'.
[06.13.15 19:35:30] INFO: [ITLHost] Starting shell utility 'cleanDir_dgidx-output'.
[06.13.15 19:35:31] INFO: [ITLHost] Starting shell utility 'move_-_to_processing'.
[06.13.15 19:35:32] INFO: [ITLHost] Starting copy utility 'fetch_config_to_input_for_forge_Forge'.
[06.13.15 19:35:34] INFO: [ITLHost] Starting backup utility 'backup_log_dir_for_component_ConfigurationGeneratorForge'.
[06.13.15 19:35:35] INFO: [ITLHost] Starting component 'ConfigurationGeneratorForge'.
[06.13.15 19:35:45] SEVERE: Batch component  'ConfigurationGeneratorForge' failed. Refer to component logs in C:\Endeca\apps\Store\config\script\..\..\.\logs\forges\ConfigurationGeneratorForge on host ITLHost.
Occurred while executing line 20 of valid BeanShell script:
[[

17|
18|        // Generate instance configuration
19|        ConfigurationGeneratorForge.archiveLogDir();
20|        ConfigurationGeneratorForge.run();
21|
22|        // archive logs and run ITL
23|        Forge.archiveLogDir();

]]

[06.13.15 19:35:45] SEVERE: Caught an exception while invoking method 'run' on object 'BaselineUpdate'. Releasing locks.

Caused by java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl invoke0 - null
Caused by com.endeca.soleng.eac.toolkit.exception.AppControlException
com.endeca.soleng.eac.toolkit.script.Script runBeanShellScript - Error executing valid BeanShell script.
Caused by com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
com.endeca.soleng.eac.toolkit.component.BatchComponent run - Batch component  'ConfigurationGeneratorForge' failed. Refer to component logs in C:\Endeca\apps\Store\config\script\..\..\.\logs\forges\ConfigurationGeneratorForge on host ITLHost.

[06.13.15 19:35:45] INFO: Released lock 'update_lock'.

C:\Endeca\apps\Store\control>


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

Here is stack trace from ConfigurationGeneratorForge.start.log

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

INFO    06/13/15 14:05:38.432 UTC (1434204338431)    FORGE    {config}: (AdapterRunner): Adapter class: com.endeca.itl.fcm.integration.cadk.ifdi.RecordPropertyRenamer  
ERROR    06/13/15 14:05:38.432 UTC (1434204338431)    FORGE    {config}: (AdapterRunner): java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
 com.endeca.edf.adapter.AdapterRunner$LoadAdapterException: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
     at com.endeca.edf.adapter.AdapterRunner.loadAdapter(AdapterRunner.java:326)
     at com.endeca.edf.adapter.AdapterRunner.run(AdapterRunner.java:162)
     at com.endeca.edf.adapter.AdapterRunner.main(AdapterRunner.java:43)
 Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
     at com.endeca.itl.fcm.integration.cadk.ifdi.RecordPropertyRenamer.<init>(RecordPropertyRenamer.java:44)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at java.lang.Class.newInstance0(Class.java:355)
     at java.lang.Class.newInstance(Class.java:308)
     at com.endeca.edf.adapter.AdapterRunner.loadAdapter(AdapterRunner.java:317)
     ... 2 more
 Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
     ... 10 more
    

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

Solution : Replace value recordstore-forge-adapter-3.1.1.jar with recordstore-forge-adapter-3.1.2.jar in CAS_RS_CLASSPATH property of environment.properties [This file ia available in <application directory>\config\script\].

Friday, 12 June 2015

Prevent Cross-Site Script attacks in ATG using SecurityServlet

Oracle ATG Web Commerce includes a component,  /atg/dynamo/servlet/dafpipeline/SecurityServlet, that monitors query parameters and stops processes if they appear suspicious. 

The SecurityServlet component uses the /atg/dynamo/servlet/security/ParameterValidator component to check query parameters.

The SecurityServlet component is enabled by default. You can disable it by removing /atg/dynamo/servlet/dafpipeline/SecurityServlet from the insertableServlets property of the /atg/dynamo/servlet/dafpipeline/DynamoHandler/ component.

 By default ParameterValidator  handle below.
  1.  illegal html tags.
  2.  illegal html attributes.
  3.  Parameter values with illegal pattern.
You can enhance the handling of  the suspicious  parameters values (point 3 above) by configuring below property in ParameterValidator. 

Default illegal regex is

illegalRegexes=javascript\\s*:,(^|[^a-zA-Z])x\\s*:,vbscript\\s*:,/\\s*>,^\\s*>


Now add alert and expression. Then expression will be.

illegalRegexes=javascript\\s*:,(^|[^a-zA-Z])x\\s*:,vbscript\\s*:,/\\s*>,^\\s*>,alert(\\(|%28),expression(\\(|%28)

Sunday, 24 May 2015

Delete Record Store For An Endeca Application

In the process of removing an Endeca application we also need to remove related CAS record stores.

Here is the script that will help.

Save this as bat file then invoke from control folder of application you are removing.

==================================================================
setlocal

set CONTROL_DIR=%~dp0

call %CONTROL_DIR%\..\config\script\set_environment.bat
if not %ERRORLEVEL%==0 (
    echo Failed to set script environment.
    exit /B 1
)

set RS_PREFIX=%ENDECA_PROJECT_NAME%
set RS_LANG=%LANGUAGE_ID%

echo These record stores exist:
call %CAS_ROOT%\bin\component-manager-cmd.bat list-components
echo ==================================================

echo Dropping record stores (errors will occur on non-existent rs):
call %CAS_ROOT%\bin\component-manager-cmd.bat delete-component -n %RS_PREFIX%_%RS_LANG%_schema
call %CAS_ROOT%\bin\component-manager-cmd.bat delete-component -n %RS_PREFIX%_%RS_LANG%_dimvals
call %CAS_ROOT%\bin\component-manager-cmd.bat delete-component -n %RS_PREFIX%_%RS_LANG%_prules
call %CAS_ROOT%\bin\component-manager-cmd.bat delete-component -n %RS_PREFIX%_%RS_LANG%_data
echo ==================================================

echo Record stores deleted:
==================================================================

You can also create this script from initialize_rs_feeds.bat (located in conttrol folder). Remove content in this file after 

echo Creating fresh record stores.

Here is the output.In this case file is saved as Record_Store_Drop.bat and invoked from Store application.



Saturday, 23 May 2015

Resolved Error : Search interface "All" contains a nonexistent member "product.repositoryId"

While importing CRS endeca studio project (CRS.esp) file into Endeca Developer Studio it was throwing error.

Error : Search interface "All" contains a nonexistent member "product.repositoryId".


After analyzing I found that product.repositoryId was missing from CRS.prop_refs.xml.

Manually adding below entry in this file resolved this issue.

<PROP_REF NAME="product.repositoryId" TYPE="ALPHA"/>


Sunday, 17 May 2015

Repository Cached Items are no more puzzle


While analyzing cache behaviour for our application. I came to know one more interesting thing related to repository cache. That is to print the content of item-cache.



The <dump-caches> tag can be used to print out the contents of the item cache for one or more item descriptors.

There are two attributes in this tag.
  
   1. dump-type It takes  one of the values from below set.
         - debug : To display  cache items.
         - queries : Creates a log entry consisting of the <load-items> tag that is used to reload the cache.
         - both : Combines the output of debug and queries.
   2. item-descriptors  A comma-separated list of one or more item descriptor names. If no item descriptors are specified, all item descriptor caches are exported.
 

Wednesday, 13 May 2015

ATG Repository Item Cache Interesting


While analyzing repository item cache related issues. I found interesting point about item cache size configuration in the case of item descriptor inheritance. 

Link :
http://docs.oracle.com/cd/E26180_01/Platform.94/RepositoryGuide/html/s1010cacheconfiguration01.html

How item cache size works : It is the maximum number of items of this type to store in the item cache. When this maximum is exceeded, the oldest items are removed from the cache.

Here is the fact : Within an inheritance tree, the last-read item descriptor’s item-cache-size setting applies to all item descriptors within the inheritance tree. In order to ensure the desired item cache size, be sure to assign the same item-cache-size to all related item descriptors 

Default Item Cache Value : 1000

Monday, 20 April 2015

ATG Calendar Scheduler interesting

Today I am going to explain very interesting point about ATG schedulers.



To configure the scheduler in ATG we need to assign value to schedule property of the scheduler.
 There are 3 types of formats for this property.
  1. Relative Schedule.
  2. Periodic Schedule.
  3. Calendar Schedule.
Out of above mentioned formats Calendar Schedule is most confusing.Here is the syntax for Calendar Schedule.

Syntax : calendar <months> <dates> <days of week>  <occurrences in month> <hours> <minutes>

Example schedule 

calendar * * 1 * 22 0

Here the * in date field will invoke this scheduler every day. 

Thumb rule is

A * entry selects all values for that field. A period (.) selects no values.

calendar * . 1 * 22 0

Above scheduler will run weekly.