JBoss 7.1.1 change JNDI bindings at runtime

In JBoss 7.1.1 in standalone mode, all JNDI bindings are configured in the standalone.xml file in jboss: domain: naming: 1.1 subsystem. According to the documentation, standalone.xml cannot be changed at server startup. I tried to use the JBoss CLI, but I do not know how to write / modify the resource.

How to change value in JNDI without restarting jboss?

+4
source share
2 answers

Should help you: https://docs.jboss.org/author/display/AS71/JNDI+Reference

The topic is binding records to JNDI:

An example standalone.xml might look like this:

<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 through the CLI:

 /subsystem=naming/binding=java\:global\/mybinding:add(binding-type=simple, type=long, value=1000) 


To view all the parameters that were added by the add command (this can actually get a description of any CLI command):

 /subsystem=naming/binding=*:read-operation-description(name=add) 


Not tried, but I hope this helps!

+4
source

This question has many views, so I will answer it. Inspired by @mik's answer, I realized that to change the value of some JNDI key, for example, java:jboss/api/key in newApiKey, run the 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 the server, and also saved (updated) in standalone.xml so that it does not get lost after the server reboots.

+3
source

Source: https://habr.com/ru/post/1415072/


All Articles