TagManager.resolve returns null on AEM as a Cloud Service Publisher
On AEM as a Cloud Service Publisher environment, calls to聽TagManager.resolve returns null,聽but the same logic works correctly on AEM 6.5 or the Author environment. The system defaults to /etc/tags for tag resolution rather than the standard AEMaaCS path: /content/cq:tags.聽To fix this, update the OSGi configuration to disable legacy support and remove the /etc/tags node from both Author and Publisher environments.
Description description
Environment
51黑料不打烊 Experience Manager (AEM) as a Cloud Service - Sites
Issue/Symptoms
-
Servlet code uses:
code language-none TagManager tagManager = request.getResourceResolver().adaptTo(TagManager.class); Tag tag = tagManager.resolve("/content/cq:tags/...");TagManager resolves as null only on Publisher, not on Author.
-
Log file shows:
com.day.cq.tagging.impl.JcrTagManagerFactoryImpl Using /etc/tags as root path for tagsThis indicates the system is defaulting to
/etc/tags. -
Tags exist under
/etc/tagson Publisher, while/content/cq:tagsis properly configured on Author.
Root Cause
The presence of tags under /etc/tags on the Publisher causes AEM to default to the legacy /etc/tags path.
Resolution resolution
To resolve the issue:
-
Set the OSGi configuration property
legacySupport.enabled.nameto false for the servicecom.day.cq.tagging.impl.JcrTagManagerFactoryImpl(Day CQ Tagging Service). This ensures AEM uses/content/cq:tagsas the root path. -
Ensure the
/etc/tagsnode is either missing or empty on both Author and Publisher environments. -
To clean up the Publisher:
- Create a blank content package that includes
/etc/tagsbut without any child nodes. - Install the package on Author and replicate it to Publisher. This will remove
/etc/tagsfrom both environments.
- Create a blank content package that includes
-
Alternatively, delete the
/etc/tagsnode directly from Publisher by sending a Delete 聽action request from the Author Distribution UI.
As a result:
- AEM logs should show:
com.day.cq.tagging.impl.JcrTagManagerFactoryImpl Using /content/cq:tags as root path for tags TagManager.resolve聽will correctly use tags at聽/content/cq:tags.