Skip to content

Instantly share code, notes, and snippets.

andrewmkhoury /
Created August 16, 2021 00:10
Adobe Target + IMS integration "Create offer request failed!"


15.08.2021 16:57:24.511 *ERROR* [[0:0:0:0:0:0:0:1] [1629071844241] POST /libs/cq/experience-fragments/content/commons/targetexporter.html HTTP/1.1] com.adobe.cq.xf.impl.adobetarget.exporter.AbstractExperienceFragmentExporter Create offer request failed!
API request failed Create offer request failed!
	at com.adobe.cq.xf.impl.adobetarget.exporter.AbstractExperienceFragmentExporter.exportVariation(
andrewmkhoury / findLargeBinaries.groovy
Created May 5, 2020 21:18
Apache Oak Groovy Script to find large binary properties in Oak JCR
View findLargeBinaries.groovy
//Adaptation of @stillalex's script from here
//This version works with Oak 1.6 and later versions
import java.util.concurrent.atomic.AtomicInteger
import org.apache.jackrabbit.oak.api.Type
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
import java.util.List
View 1-Oak SegmentNotFoundException repair

The objective here is to find all SegmentNotFoundException type corruption and remove it (as we don't have a valid backup)

Before running any of the below steps we created an index.json file (see the file below) which contains only the index definitions of the corrupted indexes.

  1. This generates the file indexing-results\index-definities.json
java -Xmx8g -jar oak-run-1.8.12.jar index --fds-path=crx-quickstart\repository\datastore crx-quickstart\repository\segmentstore --index-definitions
  1. From that file we copied only the definitions we needed and created index.json (file attached here )
andrewmkhoury / 1 - Fix
Last active July 28, 2021 05:26
Fix Corrupt Jackrabbit Oak Version Histories
View 1 - Fix
andrewmkhoury /
Last active April 29, 2021 08:17
How to disable Text Extraction in Apache Jackrabbit Oak
  1. Find the location of the oak-lucene jar file:
    find crx-quickstart/launchpad/felix -name "" -exec grep oak-lucene {} \; -print
    Example output:
  2. Take the second line of the output and remove from the path, following the example above, we have:
andrewmkhoury / 1 Instructions - Find Oak
Last active April 29, 2021 08:16
Oak count node check in script console - use while AEM / Oak is running
View 1 Instructions - Find Oak

NOTE: Steps moved here instead

  1. Go to http://host:port/system/console/bundles and install these two bundles
  2. Go to http://host/system/console/configMgr/
  3. Add org.apache.felix.webconsole.plugins.scriptconsole to "Whitelist regexp" and save
  4. After the two bundles fully install then go to http://host:port/system/console/slinglog
  5. Click "Add New Logger" and set log level to "Info", "Log File" to "logs/countnodes.log", and "Logger" to "countNodes.groovy"
andrewmkhoury /
Last active April 29, 2021 08:17
Script to set the rep:externalId if it is missing in AEM due to users being migrated from an older version of CQ/AEM
andrewmkhoury /
Last active March 5, 2021 01:36
oak-run Groovy script to reset the Adobe AEM "admin" user password

To run this script:

  1. Download the oak-run version matching the version of Oak installed in AEM:
  2. Download the attached adminUtils.groovy script
  3. Upload the adminUtils.groovy script and the oak-run jar to your AEM server
  4. Run the command to start the oak-run console. For example:
    java -Xmx2048m -jar /tmp/oak-run-1.6.1.jar console /app/aem/aem63/crx-quickstart/repository/segmentstore --read-write
  5. Once the oak-run console is open then load the groovy script using this command:
andrewmkhoury /
Last active July 15, 2019 12:32
Migrating AEM Users, Groups and ACLs between instances
  1. Migrate users and groups (If users were not imported automatically via LDAP) Package users and groups (2 separate packages) on the old system (excluding admin and anonymous OOTB users)
    1. Go to CRXDE lite app /crx/de/index.jsp and log in as admin user (on the old system)
    2. Go to "Tools" => "Query"
    3. In the bottom "Query" box enter this query to find the admin user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="admin"]
    4. Click "Execute" and copy the path of the admin user node in the results to a text file
    5. Repeat step 3 with a query for anonymous user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="anonymous"]
  2. Click "Execute" and copy the path of the anonymous user node in the results to a text file (so now you should have two paths, one for "admin" and one for "anonymous")
andrewmkhoury /
Last active August 10, 2022 10:37
JavaScript Notes
  • Arrows - => defines function sharing lexical this as function body (unlike subfunctions).
  • Classes - class, extends, constructor,get,set, static are syntactic sugar over prototypes patterns (i.e. proper-interoperable class definitions).
    class SkinnedMesh extends THREE.Mesh {
      constructor(geometry, materials) {
        super(geometry, materials);
        this.idMatrix = SkinnedMesh.defaultMatrix();
        this.bones = [];

this.boneMatrices = [];