Skip to content

Instantly share code, notes, and snippets.

If you find an error like this one in the logs (more of an example error below [1]) you may have a corrupt Oak revision:

Caused by: org.apache.jackrabbit.oak.plugins.document.DocumentStoreException: The node 4:/oak:index/event.job.topic/:index/replication was already added in revision
r14e64620028-0-1, before
r14e6463b2c0-0-1; document:
{_lastRev={r0-0-1=r14e64620028-0-1},
_deletedOnce=true,

To verify whether or not it is real corruption, do the following then save the format-revision.html to your system and open it in a browser. Paste the two revisions into the corresponding text fields. You will get output like this:

@andrewmkhoury
andrewmkhoury / Dump datastore references.md
Last active April 29, 2021 08:19
How to dump the list of datastore references in Oak``
  1. Download oak-run version matching the version of oak-core you have and upload it to the server: wget http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/

  2. Run this command to extract the list of datastore files from the segmentstore:

    java -Xmx6g -jar oak-run-*.jar dumpdatastorerefs [<segment_path>|<mongo_uri>] [dump_path]

    e.g. TarMK java -Xmx6g -jar oak-run-*.jar dumpdatastorerefs crx-quickstart/repository/segmentstore .

@andrewmkhoury
andrewmkhoury / Oak Datastore Check.md
Last active April 29, 2021 08:19
Oak Datastore Consistency Check
  1. Download the oak-run version that matches what is installed from http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
  2. Stop all AEM instances in cluster
  3. Upload the oak-run jar to the AEM server
  4. Run this command to start the oak console
  • on TarMK:
   java -Xmx4g -jar target/oak-run.jar console --quiet /path/to/segmentstore
  • For MongoMK run this:
@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 = [];

@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 / 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 / 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 / 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
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 - Fix Versions.md
Last active July 28, 2021 05:26
Fix Corrupt Jackrabbit Oak Version Histories