Netcentric / accesscontroltool

Rights and roles management for AEM made easy
Eclipse Public License 1.0
151 stars 91 forks source link

Replicating packages which require the ACTool hook are not installed #72

Closed kwin closed 7 years ago

kwin commented 8 years ago

Although on the author instance you see no error, on the publish instance, the following error is logged when replicating a package which references the ACTool hook

[... POST /bin/receive HTTP/1.1] com.day.jcr.vault.packaging.impl.JrVltInstallHookProcessor Loading Hook actool: Main-Class = biz.netcentric.cq.tools.actool.installhook.AcToolInstallHook
[... POST /bin/receive HTTP/1.1] com.day.jcr.vault.packaging.impl.JrVltInstallHookProcessor Error while initializing hook: com.day.jcr.vault.packaging.PackageException: hook's main class biz.netcentric.cq.tools.actool.installhook.AcToolInstallHook not found: actool

This is due to wrong classloader being used to load the hook class (in contrast to what the package manager does). In fact it is the thread context class loader (which is never working in the OSGi context).

kwin commented 8 years ago

The reason for that is that the com.day.cq.replication.impl.ReplicationReceiverImpl which is responsible for installing/extracing packages after they have been received through replication is not setting the classloader for the hooks accordingly. The Package Manager in contrast sets the hook classloader correctly to the DynamicClassLoader in com.day.crx.packmgr.impl.servlets.ServiceServlet (through com.day.crx.packmgr.impl.MainServlet.activate(...)).

kwin commented 8 years ago

I created https://issues.apache.org/jira/browse/JCRVLT-116 for a generic fix. But in AEM there is another dedicated InstallHookProcessor being used, named JrVltInstallHookProcessor. Therefore I opened a support ticket with Adobe.

kwin commented 8 years ago

This is tracked now in the internal Adobe bugtracker in CQ-86760 (no ETA for the fix though).

kwin commented 7 years ago

With AEM 6.3 (load 21) the bundle com.adobe.granite.replication.core in version 6.2.26 only uses org.apache.jackrabbit.vault.packaging.JcrPackageManager instead of com.day.jcr.vault.packaging.JcrPackageManager. Therefore the fix being applied in https://issues.apache.org/jira/browse/JCRVLT-116 (also part of AEM 6.3) solves the problem for AEM 6.3.

mnougarede commented 7 years ago

Hi @kwin,

We are using AEM 6.2 for one of our client and use your wonderful project to manage ACLs. This issue is a bit painful for us since we have to manually install this package in order to trigger the hook on our publish instances.

Is there any way this issue is gonna be fixed on 6.2 ?

Best regards,

Maxime Nougarede

kwin commented 7 years ago

Hi @mnougarede, the only applicable workaround for AEM < 6.3 is to explicitly install those packages via the Package Manager UI (or the according ReSTful service) on each publish instance instead of relying on replication.

tony-schumacher commented 5 years ago

Hi @kwin, solved it. Thanks!