Search code examples
javajakarta-eejbossjcrmodeshape

How to register namespace for own node type in Modeshape 4


I am using all the latest version of JBoss, Modeshape etc if that matter. I want to add a custom node type for a mixin. Modeshape is installed as a subsystem on my JBoss 8.1. How do I register the namespace when I get the repository with JNDI, and when I create a repository instance in my test classes?

I have this CND:

<ex = 'http://example.com/jcr/cnd'>

[ex:fileAssociation] mixin
- ex:versionOf (PATH)

This causes:

Caused by: org.modeshape.jcr.value.NamespaceException: There is no namespace registered for the prefix "ex"

When I try to run the test. This is my simple modeshape configuration file:

{
  "node-types":["/nodetype/file-association.cnd"],
  "workspaces": {
    "default": "bp",
    "predefined": ["bp"]
  }
}

Solution

  • ModeShape automatically registers any namespaces it finds in a CND file. Chances are, ModeShape is not actually reading your file-association.cnd file. Make sure that the path you specify in the configuration file is valid.

    In this case, since ModeShape is installed in Wildfly 8.1, you must configure ModeShape through Wildfly's configuration file. See the ModeShape documentation for more details.