Jahia 8 Jahia 7.3

Invalid namespace error when deploying module

Question

Module deployment fails with the following error:

ERROR [FelixDispatchQueue] org.jahia.services.content.nodetypes.JahiaCndReader: Invalid namespace declaration : prefix already declared (/META-INF/definitions.cnd, line 2)
ERROR [FelixDispatchQueue] org.jahia.modules.forms.bundle.DefinitionService: Invalid namespace declaration : prefix already declared (/META-INF/definitions.cnd, line 2) (/META-INF/definitions.cnd)
org.jahia.services.content.nodetypes.ParseException: Invalid namespace declaration : prefix already declared (/META-INF/definitions.cnd, line 2) (/META-INF/definitions.cnd)
    at org.jahia.services.content.nodetypes.JahiaCndReader.parse(JahiaCndReader.java:363)
    at org.jahia.services.content.nodetypes.NodeTypeRegistry.getDefinitionsFromFile(NodeTypeRegistry.java:281)
    at org.jahia.modules.forms.bundle.DefinitionService.parseDefinitionWizards(DefinitionService.java:222)
    at org.jahia.modules.forms.bundle.DefinitionService.bundleChanged(DefinitionService.java:162)

Cause

The error points to an issue with the namespace definition. The namespaces in definitions.cnd of the module in question must have already been declared in another module, but with a different uri.

For using an already registered namespace, the uri should also be same.

Solution

Update the definition to reflect the registered uri and redeploy the module.