Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to modify JNDI Custom Resources Properties Values on the fly
    primarykey
    data
    text
    <p>My architecture: <br> GlassFish Server Open Source Edition 3.1.2.2 (5)<br> Java EE 6<br> Eclipse IDE<br></p> <p>I created a EJB Timer, which prints a log message:</p> <pre><code>@Startup @Singleton public class ProgrammaticalTimerEJB { private final Logger log = Logger.getLogger(getClass().getName()); @Resource(name = "properties/mailconfig") private Properties mailProperties; @Resource private TimerService timerService; @PostConstruct public void createProgrammaticalTimer() { log.log(Level.INFO, "ProgrammaticalTimerEJB initialized"); ScheduleExpression everyTenSeconds = new ScheduleExpression().second("*/10").minute("*").hour("*"); timerService.createCalendarTimer(everyTenSeconds, new TimerConfig("passed message " + new Date(), false)); } @Timeout public void handleTimer(final Timer timer) { log.info(new Date().toGMTString() + " Programmatical: " + mailProperties.getProperty("to")); } } </code></pre> <p>This class injects my custom JNDI Resource:</p> <pre><code> @Resource(name = "properties/mailconfig") private Properties mailProperties; </code></pre> <p>Eclipse Console:</p> <pre><code>INFO: 2 Aug 2013 10:55:40 GMT Programmatical: tim.herold@mylocal.de INFO: 2 Aug 2013 10:55:50 GMT Programmatical: tim.herold@mylocal.de INFO: 2 Aug 2013 10:56:00 GMT Programmatical: tim.herold@mylocal.de </code></pre> <p>Glassfish settings</p> <pre><code>asadmin&gt; get server.resources.custom-resource.properties/mailconfig.property server.resources.custom-resource.properties/mailconfig.property.to=tim.herold@mylocal.de Command get executed successfully. asadmin&gt; </code></pre> <p><br><br> <img src="https://i.stack.imgur.com/uBUtM.png" alt="enter image description here"> <br><br> Now i want to change this property value during application runtime. Editing it via Adminconsole or Asadmin doesnt work. Is this possible, or is there an other/better soulution?</p> <p>Many thanks in advance </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload