Several ejbs in ears need to access an URL.
I do not want to hardcode the URL, nor do I want to write it into the ejb deployment descriptor. In practice ejb-jar.xml is as hard to change as source code, because you have to rebuild the ear. And, ejb-jar.xml is in source control, and I don't want to have concrete host names in source control.
Anyway, I don't want to change five ears because a URL changes.
First idea is to use a property file and put it in the server classpath. Not very elegant.
Second idea is to read it from JNDI. But how to get it there? From an XML file parsed by a server startup class? What if the option can be changed at server runtime?
Next idea is to get the option from JMX and put it from there into JNDI. But how? How is the data specified and read in?
Or is there a portable way to access JMX from the bean code?