Nodetype dependancies issue

  Written by The Jahia Team
 
Developers
   Estimated reading time:
7.1.1.0

The customer has defined two definition files in his module. However, he got randomly the following error:
 

Unknown supertype cel:success_messages for type cel:settings_messages (file [/home/vagrant/Documents/CORTEX/application/rtecel/src/main/resources/META-INF/contribuable_definitions.cnd])
javax.jcr.RepositoryException: Unknown supertype cel:error_message for type cel:account_messages
Unknown supertype cel:field_errors for type cel:account_messages
Unknown supertype cel:email_errors for type cel:account_messages
Unknown supertype cel:phone_format_errors for type cel:account_messages
Unknown supertype cel:success_messages for type cel:account_messages
Unknown supertype cel:error_message for type cel:settings_messages
Unknown supertype cel:field_errors for type cel:settings_messages
Unknown supertype cel:success_messages for type cel:settings_messages (file [/home/vagrant/Documents/CORTEX/application/rtecel/src/main/resources/META-INF/contribuable_definitions.cnd])
at org.jahia.modules.external.modules.ModulesDataSource.registerCndFiles(ModulesDataSource.java:374)
at org.jahia.modules.external.modules.ModulesDataSource.start(ModulesDataSource.java:327)
at org.jahia.modules.external.ExternalContentStoreProvider.start(ExternalContentStoreProvider.java:140)
at org.jahia.modules.external.modules.osgi.ModulesSourceSpringInitializer.mountSourcesProvider(ModulesSourceSpringInitializer.java:132)
at org.jahia.modules.external.modules.osgi.ModulesSourceSpringInitializer.mountBundle(ModulesSourceSpringInitializer.java:163)
at org.jahia.modules.external.modules.osgi.ModulesSourceActivator$1.bundleChanged(ModulesSourceActivator.java:81)
at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:913)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4531)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2169)
at org.apache.felix.framework.Felix$RefreshHelper.restart(Felix.java:5051)
at org.apache.felix.framework.Felix.refreshPackages(Felix.java:4243)
at org.apache.felix.framework.FrameworkWiringImpl.run(FrameworkWiringImpl.java:188)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jahia.services.content.nodetypes.ParseException: Unknown supertype cel:error_message for type cel:account_messages

Cause

In this particular case, the cel:error, cel:field_errors, cel:email_errors, cel:phone_format_errors, cel:success_messages, cel:error_message and cel:success_messages supertypes are defined in the technical_defintions.cnd file.

So, there is a dependency between both definitions files: "technical_defintions.cnd" and "contribuable_definitions.cnd".

If the contribuable_definitions.cnd is loaded in first place, the "javax.jcr.RepositoryException: Unknown supertype ..." exception is thrown.

Solution

Use a unique definition file with the definition of the supertypes and the définition of inherited node types of these supertypes as well.