You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pham Anh Tuan <an...@ichi-corp.jp> on 2005/07/04 04:12:06 UTC

[HELP] Who have ever used Quartz in Struts, help me :(

Hi all,

I got error when I use Quartz as a plugin in Struts.

For more details.

I will show all you 2 files which I defined like below:

MyBot.java:

import java.text.ParseException;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.spi.SchedulerPlugin;

public class MyBot implements SchedulerPlugin {
public MyBot() {
}

public void initialize(String name, final Scheduler scheduler)
throws SchedulerException{

try {
String strCronExp = "0 0/1 * * * ?";

SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();

Scheduler sched = schedFact.getScheduler();

sched.start();

JobDetail jobDetail = new JobDetail("botJob",
Scheduler.DEFAULT_GROUP,
BotJob.class);

CronTrigger trigger = new CronTrigger("botTrigger",
Scheduler.DEFAULT_GROUP,
strCronExp);

sched.scheduleJob(jobDetail, trigger); 
}catch(ParseException e){
}
}

public void start() {
// do nothing.
}

public void shutdown() {
// nothing to do in this case (since the scheduler is already shutting
// down)
}
}


BotJob.java:

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class BotJob implements Job {

public BotJob() {
}

public void execute(JobExecutionContext context)
throws JobExecutionException {
// doing nothing
}
}

2 files above are in the same package

in struts-config.xml
<plug-in className="com.ichi.auction.presentation.IchiBot" />

When I start Web App. I got error like below:

HTTP Status 503 - Servlet action is currently unavailable


message Servlet action is currently unavailable

description The requested service (Servlet action is currently unavailable) is not currently available.

hiz, help me solve this problem, plz ...

thanks for ur reading

Pham