Custom Node Type not being added with .cnd file | Community
Skip to main content
marissaw9851252
October 16, 2015
Solved

Custom Node Type not being added with .cnd file

  • October 16, 2015
  • 10 replies
  • 5822 views

I added a custom node type to the nodetypes.cnd file.  That file is in the META-INF/vault folder.  When the package is built, I cannot find this file in the package.  Is that a problem?  If so, where should this file be copied to?  To test if this may be the issue, I manually added the nodetypes.cnd file to the META-IN/vault folder of the package, but this did not solve the problem either.  I had successfully use a nodetype.cnd file a few months ago with AEM 6.0 to add a new namespace.  I am having an issue doing this now.  This time I an using AEM 6.1.

 

Contents of the nodetypes.cnd file: 

<'testXmpExt'='testXmpExt>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kunal_Gaba_

Did you also installed this file using package manager. If you just created this file manually then it won't work. To test your use case, I created a package with this file in AEM 6.1 and installed this package. Package installation logs below shows that it is installing new new node types- 

Installing node types... - sling -> http://sling.apache.org/jcr/sling/1.0 - nt -> http://www.jcp.org/jcr/nt/1.0 A testXmpExt -> testXmpExt - rep -> internal - sling:Folder - rep:RepoAccessControllable Installing privileges... 

Also, after this step I checked the node type administration page and I could see the new namespace registered.  - http://localhost:4502/crx/explorer/ui/namespace_editor.jsp?Path=&Callback=reload

10 replies

Adobe Employee
October 16, 2015

Did you include the meta-inf folder in your resource element to be included in your bundle?

<build>

        <resources>
            <resource>
                <directory>src/main/content/jcr_root</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/.vlt</exclude>
                    <exclude>**/.vltignore</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/content/META-INF/vault</directory>
                <targetPath>../vault-work/META-INF/vault</targetPath>
            </resource>
        </resources>

marissaw9851252
October 16, 2015

Yes.  I have this.

Kunal_Gaba_
October 16, 2015

I think the META-INF/vault location works when you include the cnd file as part of the OSGI bundle and configure the maven-bundle plugin for the same. But to install it using the package manager you can just include this file as normal content in any folder. For example, you can define filters in your package to deploy this file to /apps/<project>/nodetypes/nodetypes.cnd

marissaw9851252
October 16, 2015

I tried adding this file under /apps/testproject/nodetype and it still didn't work.

Kunal_Gaba_
October 16, 2015

I think the contents of the file are not right as per CND file notations. Can you check the documentation here and verify - https://jackrabbit.apache.org/jcr/node-type-notation.html

marissaw9851252
October 16, 2015

I tried both of the following and neither worked.

<'testXmpExt'='testXmpExt'>

<testXmpExt='testXmpExt'>

Kunal_Gaba_
Kunal_Gaba_Accepted solution
October 16, 2015

Did you also installed this file using package manager. If you just created this file manually then it won't work. To test your use case, I created a package with this file in AEM 6.1 and installed this package. Package installation logs below shows that it is installing new new node types- 

Installing node types... - sling -> http://sling.apache.org/jcr/sling/1.0 - nt -> http://www.jcp.org/jcr/nt/1.0 A testXmpExt -> testXmpExt - rep -> internal - sling:Folder - rep:RepoAccessControllable Installing privileges... 

Also, after this step I checked the node type administration page and I could see the new namespace registered.  - http://localhost:4502/crx/explorer/ui/namespace_editor.jsp?Path=&Callback=reload

marissaw9851252
October 16, 2015

I installed the package using package manager.  Can you attach the package that you created so I can compare it to mine?

Kunal_Gaba_
October 16, 2015

I tested the attached package. Change the extension to ".zip" after download.

marissaw9851252
October 16, 2015

The package you provided installed fine.  I tweaked mine and it now seems to work.  The nodetypes.cnd file in the META-INF/vault folder has the following contents.  At first I added another cnd file under apps/shared/nodetypes, but I didn't end up needing it.  Thanks for the help.

<'sling'='http://sling.apache.org/jcr/sling/1.0'>
<'nt'='http://www.jcp.org/jcr/nt/1.0'>
<'rep'='internal'>
<'testXmpExt'='testXmpExt'>

[sling:Folder] > nt:folder
  - * (undefined) multiple
  - * (undefined)
  + * (nt:base) = sling:Folder version

[rep:RepoAccessControllable]
  mixin
  + rep:repoPolicy (rep:Policy) protected ignore