我正在使用所有最新版本的JBoss,Modeshape等。我想为混合添加自定义节点类型。 Modeshape已作为子系统安装在我的JBoss 8.1上。使用JNDI获取存储库以及在测试类中创建存储库实例时,如何注册名称空间?

我有这个CND:

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

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


这引起:

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


当我尝试运行测试时。这是我简单的modeshape配置文件:

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

最佳答案

ModeShape会自动将在CND文件中找到的所有名称空间注册。可能是,ModeShape实际上并未读取您的file-association.cnd文件。确保您在配置文件中指定的路径有效。

在这种情况下,由于ModeShape已安装在Wildfly 8.1中,因此您必须通过Wildfly的配置文件来配置ModeShape。有关更多详细信息,请参见ModeShape documentation

09-25 20:35