Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Issue with overlaying nodes from libs to apps within project structure

Avatar

Level 4

I am attempting to add new content to the "tools" > "general" tab within aem. To get the node structure accurate, I have overlaid the node directory /libs/cq/core/content/nav/tools/general, then created the necessary node underneath general for my content. 

 

The issue is when I try to recreate this structure within my codebase and get build errors. When I copy the node structure exactly as it is in the CRXDE after overlaying, below are the following errors. I have updated the filter.xml file as well. Is there something I am missing within the ui.apps pom.xml file perhaps?

 

As you can see it mentions there's an issue with the node type nt:unstructured being a child of nt:folder. But no where in my structure is there a parent to these nodes with nt:folder. I must be misinterpreting something here, because this error does not make sense to me. 

 

--------------------------------------------------

[ERROR] ValidationViolation: "jackrabbit-nodetypes: Node '{}nav [nt:unstructured]' is not allowed as child of not contained node with potential default types '[nt:folder]': Could not find matching child node definition in parent's node type", filePath=jcr_root\apps\cq\core\content\nav\.content.xml, nodePath=/apps/cq/core/content/nav, line=3, column=39

[ERROR] ValidationViolation: "jackrabbit-nodetypes: Node '{}tools [nt:unstructured]' is not allowed as child of not contained node with potential default types '[nt:folder]': Could not find matching child node definition in parent's node type", filePath=jcr_root\apps\cq\core\content\nav\.content.xml, nodePath=/apps/cq/core/content/nav/tools, line=4, column=46


[ERROR] ValidationViolation: "jackrabbit-nodetypes: Node '{}general [nt:unstructured]' is not allowed as child of not contained
node with potential default types '[nt:folder]': Could not find matching child node definition in parent's node type", filePath=jcr_root\apps\cq\core\content\nav\.content.xml, nodePath=/apps/cq/core/content/nav/tools/general, line=5, column=53

---------------------------------------------------

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

With the filter root being

<filter root="/apps/cq/core/content/nav/tools/general"/>

all nodes you declared in the hierarchy (for example apps/cq/core/content) are ignored by the plugin and the content structure is build based on the default node type for structures (nt:folder). That means even when you define apps/cq/core/content as a nt:unstructured, the plugin ignores it.

That also means, that changing the filter root to "/apps/cq" makes the plugin taking your definitions into account.

 

 

View solution in original post

8 Replies

Avatar

Level 4

I discovered the issue, but the resolution does not make sense to me. In the filter.xml file I had:

<filter root="/apps/cq/core/content/nav/tools/general"/>

and changed to:
<filter root="/apps/cq"/>
 
Can someone explain how having the first filter path would through the errors mentioned above? Or were the errors being thrown a potential bug with the ValidationViolation?

Avatar

Community Advisor

@mmasonWD 

If a node doesn't exist in crx and you are trying to upload a child node under it using package manager or build, it will automatically create the parent node with nt:folder.  

 

In your case, the initial filter rule <filter root="/apps/cq/core/content/nav/tools/general"/> was too specific and only included the /apps/cq/core/content/nav/tools/general path. This means that the parent nodes (/apps/cq/core/content/nav and /apps/cq/core/content/nav/tools) are not present and you are trying to a add a node "general" under non-exisistant parent nodes, so they are created as nt:folder and that is the reason you see the error " [nt:unstructured]' is not allowed as child of not contained node with potential default types '[nt:folder]'
Once you update the filter rule to <filter root="/apps/cq"/>, the parent nodes are also added along with child node.
 
Let me know if you need more clarification here or I can explain this in a different way.
 
 

Avatar

Level 4

Hi thanks for the reply, 

 

But I am not sure it relates specifically to my case. My errors were showing as a result of trying to build the package with maven, prior to any type of installation. Within my code structure, I had specified each of the node types within each .content.xml file for the following paths and nodes: /apps/cq/core/content/nav/tools/general, and none were of type nt:folder. So within my structure, all nodes were present and defined correctly according to the node types for libs. 

 

Let me know if I am misinterpreting what you're saying, or if what I mentioned here makes more sense now. 

Avatar

Community Advisor

@mmasonWD 

 

Thank you for clarifying.

 

You correctly understood what I've responded above. If the parent nodes already exist, my explanation doesn't help your question. So, I need to think this differently.

Avatar

Correct answer by
Employee Advisor

With the filter root being

<filter root="/apps/cq/core/content/nav/tools/general"/>

all nodes you declared in the hierarchy (for example apps/cq/core/content) are ignored by the plugin and the content structure is build based on the default node type for structures (nt:folder). That means even when you define apps/cq/core/content as a nt:unstructured, the plugin ignores it.

That also means, that changing the filter root to "/apps/cq" makes the plugin taking your definitions into account.

 

 

Avatar

Level 4

Interesting. So even if I am defining all levels of filter roots within the ui.app.structure pom's filevault-package-maven-plugin file per documentation, like so:

  <filter><root>/apps/cq</root></filter>
  <filter><root>/apps/cq/core</root></filter>
  <filter><root>/apps/cq/core/content</root></filter>
  <filter><root>/apps/cq/core/content/nav/</root></filter>
  <filter><root>/apps/cq/core/content/nav/tools</root></filter>
  <filter><root>/apps/cq/core/content/nav/tools/general</root></filter>
 
Even doing this, what you said still holds true?

Avatar

Employee Advisor

 

you could define all nodes in the path /apps/cq/core/content/nav/tools/ to nt:unstructured nodes (by providing a proper .content.xml or whatever way you prefer); because then filevault never falls back to its defaults (which is a nt:folder for a folder in your content structure). Then the simplest case with a filter root of /apps/cq would be sufficient.

 

 

Avatar

Level 4

Sorry, I worded my previous comment strange. What you just explained is exactly how I had things structured, per the documentation, and the build was still failing. I had all .context.xml files defined, as well as all filter root paths defined. That's was what so confusing to me as why it kept failing.