Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

ConstraintViolationException {internal}policy is protected. | Eclipse AEM Dev Tools

Avatar

Level 5

I've got a problem when attempting to publish/export from Eclipse to my local 6.2 AEM author instance.

I'm attempting to migrate some old JSP page templates to a new Arch10 project, we've got a custom page property dialog tab, that is specifically for admins only, so we have some rep:policy information in the dialog.xml file. Here's a snippet of that dialog:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal" jcr:primaryType="cq:Dialog" height="400" stateful="false" xtype="dialog"> <items jcr:primaryType="cq:WidgetCollection"> <tabs jcr:primaryType="cq:TabPanel"> <items jcr:primaryType="cq:WidgetCollection"> <basic jcr:primaryType="cq:Widget" path="/libs/foundation/components/page/tab_basic.infinity.json" xtype="cqinclude"/> <adminonly jcr:primaryType="cq:Widget" jcr:mixinTypes="[rep:AccessControllable]" path="/apps/my-project/components/layouts/basePage/tab_adminonly.infinity.json" xtype="cqinclude"> <rep:policy jcr:primaryType="rep:ACL"> <deny jcr:primaryType="rep:DenyACE" rep:principalName="everyone" rep:privileges="{Name}[jcr:read]"/> <allow jcr:primaryType="rep:GrantACE" rep:principalName="administrators" rep:privileges="{Name}[jcr:read]"/> </rep:policy> </adminonly> ...

Here's the AEM console log from Eclipse:

[September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand (CREATE_ONLY_WHEN_MISSING) -> /apps : JcrResult[ success:true] (141 ms) [September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand -> /apps/my-project : JcrResult[ success:true] (78 ms) [September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand -> /apps/my-project/components : JcrResult[ success:true] (62 ms) [September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand -> /apps/my-project/components/layouts : JcrResult[ success:true] (94 ms) [September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand -> /apps/my-project/components/layouts/basePage : JcrResult[ success:true] (140 ms) [September 28, 2016 10:13:07 AM CDT] AddOrUpdateNodeCommand -> /apps/my-project/components/layouts/basePage/dialog : JcrResult[ success:false, exception: org.apache.sling.ide.transport.RepositoryException - javax.jcr.nodetype.ConstraintViolationException: {internal}policy is protected.] (47 ms) org.apache.sling.ide.transport.RepositoryException: javax.jcr.nodetype.ConstraintViolationException: {internal}policy is protected. at org.apache.sling.ide.impl.vlt.JcrResult.failure(JcrResult.java:33) at org.apache.sling.ide.impl.vlt.JcrCommand.execute(JcrCommand.java:76) at org.apache.sling.ide.transport.TracingCommand.execute(TracingCommand.java:45) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.execute(SlingLaunchpadBehaviour.java:477) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishContentModule(SlingLaunchpadBehaviour.java:467) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishModule(SlingLaunchpadBehaviour.java:238) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:1091) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1183) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:137) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774) at org.apache.sling.ide.eclipse.core.internal.ServerBehaviourDelegateWithModulePublishSupport.publish(ServerBehaviourDelegateWithModulePublishSupport.java:54) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3157) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: javax.jcr.nodetype.ConstraintViolationException: {internal}policy is protected. at org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeImpl.checkAddNodeConstraints(EffectiveNodeTypeImpl.java:375) at org.apache.jackrabbit.jcr2spi.state.ItemStateValidator.checkAddNode(ItemStateValidator.java:388) at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.addNodeState(SessionItemStateManager.java:435) at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.visit(SessionItemStateManager.java:245) at org.apache.jackrabbit.jcr2spi.operation.AddNode.accept(AddNode.java:79) at org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager.execute(SessionItemStateManager.java:215) at org.apache.jackrabbit.jcr2spi.NodeImpl.createNode(NodeImpl.java:1454) at org.apache.jackrabbit.jcr2spi.NodeImpl.addNode(NodeImpl.java:186) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.createNode(AddOrUpdateNodeCommand.java:176) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:100) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:112) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:112) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:112) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:112) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.update(AddOrUpdateNodeCommand.java:112) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.execute0(AddOrUpdateNodeCommand.java:85) at org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand.execute0(AddOrUpdateNodeCommand.java:1) at org.apache.sling.ide.impl.vlt.JcrCommand.execute(JcrCommand.java:68) ... 12 more

It seems to be a problem with the xmlns:rep="internal", if I remove that and the policy definitions, then this all works just fine... 😞

Anyone have any ideas on this? I've exhausted my Google-fu with no luck. Plenty of ConstraintViolationExceptions, but not for this specific scenario: "{internal}policy is protected."

5 Replies

Avatar

Level 5

Also probably worth mentioning. If I create this dialog in CRX DE Lite and then "Import from server..." into Eclipse, it works just fine. The next time I make a change in Eclipse and it tries to then export the apps module back to the server, that's when there's a problem.

Avatar

Level 10

I am checking with internal Adobe people. I have not seen this issue before.

Avatar

Level 5

smacdonald2008 wrote...

I am checking with internal Adobe people. I have not seen this issue before.

 

Thanks Scott! Our plan is to eventually refactor these to HTL and move structure/layout/policies to a project-specific /conf folder, but for now we need to move these as-is to continue supporting old content, until it can be updated.

Avatar

Employee

You should migrate the content without the rep:policy as the permissions should be instance specific. rep:acl nodes are protected nodes and cannot be directly migrated. If you want to migrate acls, you should be doing that separately

using this utility - http://www.wemblog.com/2011/11/how-to-create-package-based-on-xpath-in.html

Avatar

Level 2

I was facing this error sometimes back when doing "Export to server" from content jcr_root. I am using Eclipse AEM Developer Tools 1.1.0.

The way the issue was resolved was to do the vault import once:

Go to your content jcr_root folder, and use the vlt command

>vlt import -v http://localhost:4502/crx . /

This seems to have synchronized the crx with the content. Thereafter, changing the content in Eclipse did not have any issue in publishing to the crx. Hope that information helps.