I am trying to create a WildFly CLI jndi script and can not get it to work. Here is the script:
# Setting up Persona audience in JNDI
try
/subsystem=naming/binding=java\:global\/persona\/AUDIENCE:remove
finally
end-try
try
/subsystem=naming/binding=java\:global\/persona\/AUDIENCE:add(value=test, binding-type=simple)
finally
end-try
And here is what I get when I run it against a Wildfly instance:
clear;~/java/wildfly-8.0.0.Final/bin/jboss-cli.sh -c --file=jndi-config.cli
try block failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "JBAS014807: Management resource '[
(\"subsystem\" => \"naming\"),
(\"binding\" => \"java:global/persona/AUDIENCE\")
]' not found"}}
try block failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "JBAS014749: Operation handler failed: Service jboss.naming.context.java.global.persona.AUDIENCE is already registered"}}
Why am I getting the second try failure? When I run it a second time, why is the first try failing? I expected the second try to always succeed...
Thanks in advance.