Friday, October 28, 2016

Using Maven to create an RPM distribution

I've been digging around trying to find the minimum POM configuration to create an RPM distribution using Maven. Here it is for anyone else who needs it.

Friday, September 16, 2016

AEM Quick Tips

How to find the runmode
http://host:port/system/console/status-System%20Properties
Listed as sling.run.modes

How to find the version info
http://host:port/system/console/status-productinfo

Wednesday, August 24, 2016

Setting up an AEM 6.2 project with Archetype 10

Adobe hasn't released a new Archetype for Adobe Experience Manager 6.1 and 6.2, so the AEM dependancies have not been updated to use the aem-uber.jar. I noticed this when I extended WCMUse in 6.2 and it was not deprecated. This has been replaced by WCMUsePojo in 6.2. Here's what you need to do to get your AEM project working with aem-uber.jar.

Update the AEM dependency in the project root pom.xml file:

Update the referenced dependencies in the core, it.tests, ui.apps and ui.content module pom.xml files:

That should do it, now WCMUse is deprecated!

Thursday, July 28, 2016

Content Fragment Templates in AEM 6.2 means content centric sites!

Just had the opportunity to start digging through the AEM 6.2 changes, upgrades and improvements and I've stumbled across Content Fragment Templates. WOW! So many times I've seen, heard and been requested to be able to create Content Types and reuse content snippets in an easy and manageable fashion in AEM, and now it's possible.

Content Fragment Templates will allow us to create fragments of content, containing a combination of text, images and whatever we want, in a template format, with renditions, then drag and drop it into a page as if we were adding in an Asset. Great news for replying to every RFP that asks for this!

Check it out on the Adobe AEM Help:

https://helpx.adobe.com/experience-manager/using/content-fragments.html

Wednesday, June 8, 2016

AEM Lucene Index was corrupted after unexpected shutdown

We were seeing the following error message appearing in the error.log files after a recent AWS outage unexpectedly shutdown the whole EC2 instance:
org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker Could not access the Lucene index at /oak:index/lucene
java.io.EOFException: reached end of stream after reading 0 bytes; 32468 bytes expected
        at com.google.common.io.ByteStreams.readFully(ByteStreams.java:697)
        at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexFile.loadBlob(OakDirectory.java:218)
        at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexFile.readBytes(OakDirectory.java:262)
        at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexInput.readBytes(OakDirectory.java:348)
        at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexInput.readByte(OakDirectory.java:354)
        ...
AEM did not shut down cleanly when the AWS outage occurred. This log message had pushed the error.log file up to 40+ GB in size.

The first thing I checked was the "Lucene Index statistics" in the JMX Console. On a working Publish instance, this was returning the Lucene Index statistics with an Index Size of 1.2GB. On our suspect instance it was showing no statistics.

To fix this issue, we needed to kick off a Lucene Reindex. To do this you need to login to CRXDE on the instance, navigate to /oak:index/lucene and set the reindex attribute to true.

We were unable login to CRXDE. Our solution was to restart the instance, login as soon as it was available and set the reindex flag. If this solution doesn't work, you can temporarily disable the Oak Lucene bundle (named "Oak Lucene (org.apache.jackrabbit.oak-lucene)"), login to CRXDE and set the reindex flag and finally re-enable the Oak Lucene bundle.

Tuesday, May 31, 2016

Cheeky Git Commands

Just storing the list of git commands I seem to always come back to trying to find. Will reference the original source when possible.

Update the remote branch list on your local (Detlus Knowldge)
$ git remote update origin --prune

Replace the local version with the remote version
$ # fetch the latest changes
$ git fetch origin
$
$ # reset the branch to fetched changes (assuming you're working on master)
$ git reset --hard origin/master

Rename a local branch (pre-push to origin)
$ # checkout the branch to rename
$ git checkout branch-name
$ 
$ # rename the branch
$ git branch -m new-branch-name

Push and track a local branch to origin
$ # switch the branch to push and track
$ git checkout branch-name
$ 
$ # push the branch to origin
$ git push -u origin branch-name

Friday, May 6, 2016

ACS Commons twitter4j bundle not resolved

We were getting an annoying error in our log files due to the ACS Commons Twitter integration not being able to resolve the twitter4j dependancy. We were seeing this in the logs and one of the bundles remained in an "Installed" state.
06.05.2016 10:11:22.263 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle com.adobe.acs.acs-aem-commons-bundle-twitter [519]. Reason: {}. Wil
l retry.
org.osgi.framework.BundleException: Unresolved constraint in bundle com.adobe.acs.acs-aem-commons-bundle-twitter [519]: Unable to resolve 519.0: missing requirement [519.0] osgi.wiring.package; (&(osg
i.wiring.package=twitter4j)(version>=3.0.5)(!(version>=4.0.0)))
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3980)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2043)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963)
        at org.apache.sling.installer.core.impl.tasks.BundleStartTask.execute(BundleStartTask.java:93)
        at org.apache.sling.installer.core.impl.OsgiInstallerImpl.executeTasks(OsgiInstallerImpl.java:735)
        at org.apache.sling.installer.core.impl.OsgiInstallerImpl.run(OsgiInstallerImpl.java:249)
        at java.lang.Thread.run(Thread.java:745)
In the OSGi Bundles, we're seeing the following:
After a bit of digging I came across the ACS AEM Bundles page and there it is, our missing twitter4j bundle!

Installing the com.adobe.acs.bundles.twitter4j-content-1.0.0.zip bundle resolved the missing constraints, allowed the ACS Commons Twitter bundle to be installed and got rid of the constant errors.

Hope this helps someone else out there!

Thursday, April 21, 2016

AEM Quartz Scheduler Cron Expressions

AEM uses the Quartz Scheduler to configure scheduled services. The full details of the schedule expression can be found at at the Quartz Scheduler Tutorial Lesson 6: CronTrigger.

Wednesday, April 20, 2016

Easier way to find AEM cURL Commands

We've been in the process of automating everything on AEM 6.0 and this means we have to dig around and find the cURL commands that we need to run from our Puppet scripts. I used to follow the technique where I would look for the POST request after clicking a button in AEM, then looking for the URL and what parameters were passed down, then manually compile a cURL command.

This has now all changed!

In Chrome, you can now open the Developer Tools, select the Network Tab, complete your POST request, then right click on the POST URL and select "Copy as cURL". This generates the cURL command! On Chrome Windows, it gives you the option to select a CMD or Bash version.
From here you can strip out what's not necessary and you're good to go!

Tuesday, April 19, 2016

The AEM 6.0 SP2 Author Primary and Standby Switch

I spent a couple hours getting a AEM 6.0 Service Pack 2 Author Standby switched to the Author Primary. The How to Run AEM with TarMK Cold Standby doc gives some great details about to create and configure the TarMK Cold Standby. There was a bit of a fail in the details of switching the Cold Standby to become the Primary.

After a bit of digging I came across Jayan Kandathil's blog post at CQ-OPS: How to Configure an AEM 6 “Cold Standby” Failover Instance and it pointed the the missing step in AEM 6.0.

Assuming that the Author Primary and Standby are active, working and syncing data, the steps to switch the Standby to Primary should go:

  1. Shutdown the Author Primary (it's failed anyway).
  2. Shutdown the Author Standby.
  3. Snapshot/backup the Author Standby crx-quickstart directory (to use when creating the the new Author Standby).
  4. On the Author Standby instance, move (if testing) or delete (if failover) the /crx-quickstart/install/install.standby directory.
  5. On the Author Standby instance, create the /crx-quickstart/install/install.primary directory. Add in the 3 required config files for the Author Primary.
  6. On the Author Standby instance, update the /crx-quickstart/bin/start script and set the runmode from "standby" to "primary"
  7. On the Author Standby instance, start AEM. This is now the Author Primary.
If you don't remove the install.standby, it still starts in Standby mode. In Standby mode, you can access the System Console, but you have no access to the CRXDE or to AEM Sites. Removing the directory is what ensures that it has started as the AEM Primary.

Monday, January 18, 2016

Creating a file in AEM via CURL

I've just come across a requirement to create a status.html file that's purely used as a health check file. to move a stack in or out of the load-balance pool. If the file exists (returns a 200) then the node is in the pool; if it 404's then it's out of the pool.

Searching around I couldn't find much until I came across this post on the Adobe Forums: How do i create a nt:file using Curl? and that gave me the correct command to use.
echo "OK" | curl -u admin:admin -T - http://localhost:4502/etc/hc/status.html
What we're doing here is creating the contents of the file using echo and piping this into the "-T -" as the file contents. Pretty nifty!