Upgrade CFP or SP installation fails with ConstraintViolationException

Issue

When upgrading AEM, installing a Service Pack (SP) or a Cumulative Fix Pack (CFP), there is a ConstraintViolationException logged in the error.log.

Example #1:
In the example below, the error was regarding /content/communities node during installation of AEM6.3 SP1 CFP2.  That node is normally a sling: Folder but on the environment with the error, the node was nt: folder.

03.04.2018 16:28:09.921 *ERROR* [http-10.158.146.131:25104-2] org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage Error during install.
javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: /content/communities[[nt:folder]]: No matching definition found for child node enablement with effective type [nt:unstructured, rep:AccessControllable]

Example #2:
In the example below, a similar error broke the upgrade from AEM 6.0 to 6.3.  A package installation failed because the nodetype of /libs/settings/granite/operations/maintenance/granite_weekly was nt: folder instead of sling: Folder.

21.09.2017 12:03:18.132 *ERROR* [OsgiInstallerImpl] com.adobe.granite.installer.factory.packages.impl.PackageTransformer Error while processing install task of day/cq60/product:cq-platform-content:1.3.234.
org.apache.jackrabbit.vault.packaging.PackageException: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0001: /libs/settings/granite/operations/maintenance/granite_weekly[[nt:folder]]: No matching definition found for child node granite_AuditLogMaintenanceTask with effective type [nt:unstructured]

Environment

AEM 6.x

Cause

The cause is from legacy versions of AEM having a different node type for certain folders.  When the nodetype changes in future versions, this error is encountered and breaks upgrades and/or patch installations.

Resolution

Follow the steps below before applying the upgrade or fix pack. Make sure that no users are on the system.

  1. Go to http://aem-host:port/crx/de/index.jsp and log in as admin user.
  2. Browse to the node causing the error. For example, in the error above, this is /content/communities.
  3. Rename that node, for example, /content/communities to /content/communities-old.
  4. Create a node with the correct nodetype. For example, /content/communities with nodetype sling: Folder instead of nt: folder.
  5. Click Save All.
  6. Move all subnodes of the old node to the newer one that has the correct nodetype. For example, move all subnodes of /content/communities-old to /content/communities.
  7. Click Save All.

Internal Notes

 Adobe

Get help faster and easier

New user?