In JBoss 7.1.1 in standalone mode all JNDI bindings are configured in standalone.xml file in jboss:domain:naming:1.1 subsystem. According to documentation standalone.xml cannot be modified when server is running. I've tried to use JBoss CLI but I don't know how to write/modify resource.
How to change value in JNDI without restarting jboss?
Should help you: https://docs.jboss.org/author/display/AS71/JNDI+Reference
Topic - Binding entries to JNDI:
An example standalone.xml might look like:
<subsystem xmlns="urn:jboss:domain:naming:1.1" > <bindings> <simple name="java:global/a" value="100" type="int" /> <object-factory name="java:global/b" module="com.acme" class="org.acme.MyObjectFactory" /> <lookup name="java:global/c" lookup="java:global/b" /> </bindings> </subsystem>
To add these entries via the CLI:/subsystem=naming/binding=java\:global\/mybinding:add(binding-type=simple, type=long, value=1000)
To see all all options that are taken by the add command (this can actually be used to get the description of any CLI command):/subsystem=naming/binding=*:read-operation-description(name=add)
Have not tried, but i hope this helps!
The question has a lot of views so I'll answer to it. Inspired by @mik response I've figured out that to change value of some JNDI key e.g. java:jboss/api/key
to newApiKey run JBoss CLI and execute:
connect
/subsystem=naming/binding=java\:jboss\/api\/key/:write-attribute(name=value,value=newApiKey)
The change will be immediately visible on server and also stored (updated) in standalone.xml
so it won't get lost after server restart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With