java - Simulate @Startup on EJB 3.0 (WebLogic 11gR1) -


my goal set scheduled job starts running @ startup.

on ejb 3.1, like:

@startup @stateless public class schedulepoller {      @resource     timerservice timerservice;      @postconstruct     public void definescheduler() {         timerservice.createtimer(60000, 60000, null);     }      @timeout     public void checkschedule(timer timer) {         system.out.println("time: " + new date());     } } 

now problem @startup not available in ejb 3.0, updated version supported on weblogic 11gr1 (10.3.5). implies bean not constructed, not calling definescheduler method.

i have read possible solution define httpservlet, injected bean, override init method , put <load-on-startup> in web.xml file. cannot use method because project ejb module , don't have web context.

the other solution have thought far change bean @messagedriven , put message on queue after startup, require action @ every deploy.

is there way replicate @startup annotation? best option bean automatically starting @ startup, can consider script add startweblogic.cmd or other "automatic" way.

thank you.

no, there no other option ejb 3.0. said project ejb module, suggestion still create war module drive startup. use servletcontextlistener rather load-on-startup servlet since don't want have endpoint in war, want (ab)use application start notification.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -