adobe / aem-eclipse-developer-tools

The Eclipse plugin that brings you the full connection to the Adobe Experience Manager, with auto-sync and project creation wizard.
Apache License 2.0
35 stars 23 forks source link

Could not Publish to Server - Generates "Not Direct Child" Error #63

Closed jpmc216 closed 4 years ago

jpmc216 commented 8 years ago

When I try to add a AEM 6.1 content project to server (Eclipse Mars), this is the error I get.

_Could not publish to the server. Resource at path /apps/test/components/image/analytics is not a direct child of /apps/test/components/image/tab_properties. _

If i ignore this error and go ahead and make any changes under "/apps", this is the error i get.

Failed publishing path=/apps, result=JcrResult[ success:false, exception: org.apache.sling.ide.transport.RepositoryException - javax.jcr.nodetype.ConstraintViolationException: Item is protected]

I am using the latest Sling IDE tooling (1.0.10) from the below link. https://sling.apache.org/downloads.cgi#ide-tooling

rombert commented 8 years ago

Thanks for the report. Can you upload a minimal content package which reproduces the 'not direct child' problem?

jpmc216 commented 8 years ago

Rombert,

Our project folder structure is little different. So even though I am able to add this as content project, I am not able to see changes getting reflected.

I also created Linked Folder (jcr_root) to point to webapp folder. That didnt work as well.

image

rombert commented 8 years ago

How is your project structure different? Can you describe your project layout?

jpmc216 commented 8 years ago

Project layout looks this.

image

  1. We do not have "jcr_root" folder, used "webapp" folder for that.
  2. filter.xml is under this folder "src/main/resources/META-INF/vault/"

Because I was not able to add "app" part of the project as content project, I created a dummy folder with name "content' and added couple of "Linked Folder(s)" one for "jcr_root" and other for "META-INF". image

After creating the linked folders, when i try to add "app" as content project this is how it looks. If I point to any other folders, it will complain for missing filter.xml. image

Trying to add the resource to the server. image

This is what I see after I click on "Finish", image

Finally, you can see that app project is not synchronized. image

The java (core) bundle part of working perfectly fine, but not the "app" (content) part.

rombert commented 8 years ago

I have set up a folder structure similar to the one you described, and with a simple project sync works as expected ( see screenshot below )

eclipse-sling-linked-folder

Not sure what exactly is going on in your case, but I'd need a simplified project to make progress on discovering the root cause.

jpmc216 commented 8 years ago

Rombert,

I have uploaded test image component which is causing issues. Can you try adding to the same project and test your changes.

sample-component.zip

jpmc216 commented 8 years ago

Additional Information

  1. Our project is set up based on AEM 6.1.
  2. After modifying /apps as nt:folder rather than sling:Folder, I bypassed though the below error. https://github.com/Adobe-Marketing-Cloud/aem-eclipse-developer-tools/issues/1 and I am able to see "JCR Properties" for all nodes now.
  3. But I am still unable to sync the files and folders. I get the below error.

image

image

eglistefan commented 8 years ago

@jpmc216 this looks like /apps is not part of the filter.xml - check the filter.xml file under src/main/content/META-INF

jpmc216 commented 8 years ago

filter.xml looks like this.

image

eglistefan commented 8 years ago

We do not have "jcr_root" folder, used "webapp" folder for that.

perhaps that's the problem - does it work when you call it jcr_root?

jpmc216 commented 8 years ago

I have created a linked folder "jcr_root" pointing to webapp. That should work as well right?

image

eglistefan commented 8 years ago

Perhaps try without linking (but moving the content under jcr_root) - if that works and linking not, then we'd have narrowed down the problem

jpmc216 commented 8 years ago

Created folders rather than linked folders and this is the error I get.

java.lang.IllegalArgumentException: Resource at path /apps/test/components/image/analytics is not a direct child of /apps/test/components/image/tab_properties at org.apache.sling.ide.transport.ResourceProxy.addChild(ResourceProxy.java:62) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.normaliseResourceChildren(ResourceChangeCommandFactory.java:492) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.buildResourceAndInfo(ResourceChangeCommandFactory.java:154) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.addFileCommand(ResourceChangeCommandFactory.java:90) at org.apache.sling.ide.eclipse.core.internal.ResourceChangeCommandFactory.newCommandForAddedOrUpdated(ResourceChangeCommandFactory.java:81) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.addFileCommand(SlingLaunchpadBehaviour.java:554) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishContentModule(SlingLaunchpadBehaviour.java:420) at org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadBehaviour.publishModule(SlingLaunchpadBehaviour.java:228) 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:3172) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

rombert commented 8 years ago

I have tested the image component that you attached and it works fine for me ... I am using the latest trunk version, but there have been no changes which are relevant to this scenario.

It's a shot in the dark, but can you gather the Eclipse trace logs as decribed at https://sling.apache.org/documentation/development/ide-tooling.html#gathering-debug-information ? Please enable all 'Sling IDE Tooling' tracers, save them to a log file and attach them to this ticket ( feel free to mail me directly if the log contains sensitive information ).

Thanks!

paul-bjorkstrand commented 7 years ago

I have run into this in the past, and yesterday ran into it again (I forgot how exactly I fixed it last time). After debugging the Sling eclipse plugin itself, I stumbled upon how I solved the issue before.

When using the Sling IDE Tools (which AEM Eclipse Developer Tools uses and depends upon), it seems that one cannot have an arbitrarily named xml file that contains arbitrary nodes. This works when built into a package, but not with the plugin.

Our problem was originally with the cq:dialog nodes. Having _cq_dialog.xml files in the components' folders caused this error. To fix it, we did the following:

  1. Create a folder with the node name, in our case _cq_dialog which is the mangled name for cq:dialog.
  2. Move the original xml file into previously creaded folder, giving us the structure _cq_dialog/_cq_dialog.xml
  3. Rename the xml file to .content.xml.
  4. Profit!

I have not tried this for your example, but I imagine this method is extensible to your situation.

Hope this helps.

Cheers!

pulichintala commented 6 years ago

i am trying to change jcr:primaryType of a new node under ui.content and when i try to publish my changes i get this error

eclipse

can anyone help me fix this issue.

Thank you.

eglistefan commented 6 years ago

I think the problem is that you're automatically publishing the changes and that node existed previously with a different jcr:primaryType. Try manually removing the original node with CRXDE and republishing.

pulichintala commented 6 years ago

@eglistefan i tried that as well did not help, even tried deleting ui.content folder and re-publishing and also i installed the new content package as well, still getting the same error.

eglistefan commented 6 years ago

have you tried with a different node, eg /foo/bar?

pulichintala commented 6 years ago

@eglistefan deleting the main folder rather than a node and republishing fixed it. Thank you.

not-entirely-random commented 5 years ago

I consistently have this problem using AEM archetype 15 in Eclipse in Windows. AEM 6.4 Works fine until I reboot my VM and fails to deploy afterwards. It cost me a lot of hours to figure this out, so "you are welcome" if my post helps you!

The following set of steps resolve the issue for me (until next reboot):

  1. Disconnect from AEM instance in server pane

  2. Disable automatic build

  3. Select all projects - select Clean -> let Eclipse finish

  4. Select All projects -> Maven -> Update Maven project. Ensure "Refresh Workspace Resources from local filesystem" is DISABLED / not checked. Click "OK" Let Eclipse finish

  5. Project -> Build All

  6. Connect to AEM instance in debug mode in Servers Page

  7. Select "Clean and Publish" in Servers Pane

  8. Live a happy live

timdonovanuk commented 4 years ago

Thanks @not-entirely-random! I was getting this with the WKND tutorial. Following your steps fixed it.