Skip to content

Instantly share code, notes, and snippets.

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

Issue

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
com.day.cq.analytics.testandtarget.TestandtargetException: Create offer request failed!
	at com.day.cq.analytics.testandtarget.impl.RestApiAdapter.create(RestApiAdapter.java:115)
	at com.day.cq.analytics.testandtarget.impl.RestApiAdapter.createOffer(RestApiAdapter.java:98)
	at com.day.cq.analytics.testandtarget.impl.TestandtargetServiceImpl.createHTMLOffer(TestandtargetServiceImpl.java:65)
	at com.day.cq.analytics.testandtarget.impl.TestandtargetCampaignMediatorImpl.syncOffer(TestandtargetCampaignMediatorImpl.java:537)
	at com.adobe.cq.xf.impl.adobetarget.exporter.AbstractExperienceFragmentExporter.exportVariation(AbstractExperienceFragmentExporter.java:115)
@andrewmkhoury
andrewmkhoury / findLargeBinaries.groovy
Created May 5, 2020 21:18
Apache Oak Groovy Script to find large binary properties in Oak JCR
//Adaptation of @stillalex's script from here https://gist.github.com/stillalex/06303f8cc1d3780d3eab4c72575883ae
//This version works with Oak 1.6 and later versions
import java.io.InputStream;
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 com.google.common.collect.Lists
import java.util.List

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
andrewmkhoury / 1 - Fix Versions.md
Last active July 28, 2021 05:26
Fix Corrupt Jackrabbit Oak Version Histories
@andrewmkhoury
andrewmkhoury / instructions.md
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 "bundle.info" -exec grep oak-lucene {} \; -print
    
    Example output:
    launchpad:resources/install.crx3/15/oak-lucene-1.2.2.jar
    crx-quickstart/launchpad/felix/bundle96/bundle.info
    
  2. Take the second line of the output and remove bundle.info from the path, following the example above, we have:
@andrewmkhoury
andrewmkhoury / 1 Instructions - Find Oak Corruptions.md
Last active April 29, 2021 08:16
Oak count node check in script console - use while AEM / Oak is running

  1. Go to http://host:port/system/console/bundles and install these two bundles
  2. Go to http://host/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist
  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
andrewmkhoury / INSTRUCTIONS.md
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
andrewmkhoury / INSTRUCTIONS.md
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: http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run
  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
andrewmkhoury / User-Group-ACL-Migration.md
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
andrewmkhoury / ecma6_notes.md
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 = [];