jbossrepositoryjndimodeshape

How to set Jboss Modeshape JNDI property


How can ı set jndi-name property on my local jboss modeshape repository named as a "sample" I've just tried, /subsystem=modeshape/repository=sample:add(jndi-name="jcr/sample") code but it fails

{
    "outcome" => "failed",
    "failure-description" => "JBAS014803: Duplicate resource [
    (\"subsystem\" => \"modeshape\"),
    (\"repository\" => \"sample\")
]",
    "rolled-back" => true
}

Solution

  • This CLI command

    /subsystem=modeshape/repository=sample:add(jndi-name="jcr/sample")
    

    will attempt to add a repository named "sample" with the given "jndi-name" attribute. The error message indicates that you already have an existing "sample" repository, so rather than add a repository you want to just update the "jndi-name" attribute on the "sample" repository. To do this, simply use this command:

    /subsystem=modeshape/repository=sample:write-attribute(name=jndi-name,value="jcr/sample")
    

    You can read the attribute with:

    /subsystem=modeshape/repository=sample:read-attribute(name=jndi-name)
    

    and you can read the description of the repository resource with:

    /subsystem=modeshape/repository=sample:read-resoure
    

    or of the repository resource and its children resources:

    /subsystem=modeshape/repository=sample:read-resoure(recursive="true")