2
我正在使用JBoss5.1.x AS,EJB3.0。我正在嘗試添加一個工作(使用Quartz)到我的部署中。我正在註冊一個新的服務,所以它會在應用程序部署時啓動調度程序。服務未啓動註冊
我的問題是,當我部署我的應用程序時,服務永遠不會註冊。
我的代碼:
接口:
public interface ComponentMonitoringService
{
void create() throws Exception;
void start() throws Exception;
void stop();
void destroy();
}
服務:
@Service(objectName = "com.mirs.ecms.timer:service=ServerStartupManager")
@Management(ComponentMonitoringService.class)
public class ServerStartupManager implements ComponentMonitoringService
{
private SchedulerFactory schedulerFactory = null;
private Scheduler scheduler = null;
Logger logger = Logger.getLogger("ecms.log");
public void create() throws Exception
{
}
public void start() throws Exception
{
// Write your startup code
initScheduler();
}
private void initScheduler() throws ParseException, SchedulerException
{
schedulerFactory = new StdSchedulerFactory();
scheduler = schedulerFactory.getScheduler();
JobDetail startECMSJob = new JobDetail("startECMSJob", "group1", StartECMSJob.class);
CronTrigger trigger1 = new CronTrigger("cronTrigger", "TriggersGroup1", "0 0/5 * * * ?");
scheduler.scheduleJob(startECMSJob, trigger1);
scheduler.start();
}
public void stop()
{
try
{
scheduler.shutdown();
}
catch (Exception e)
{
logger.error("ServerStartupManager Failure occured during Manager stop", e);
}
}
public void destroy()
{
}
}
你如何部署你的應用程序? – 2011-02-07 08:13:02