[opencms-dev] Can´t schedule customized Job

Celio Faria Jr celiofariajr at gmail.com
Sat Jan 12 21:45:31 CET 2008


Hi all,

I´m trying to schedule an OpenCms job, and wrote a class that implements
I_CmsScheduledJob. However, I´m getting an error that says "
org.opencms.scheduler.CmsSchedulerException: Could not schedule job
"PAnalysis" for class "br.portalconhecimento.scheduling.PJob".

The .class file for the Job class are located at my module "classes" folder,
and I can construct an object from it (which means that it is in the
classpath). I also tried to package it to a jar and put it on the Tomcat
"lib" folder, but no success.

I checked the list, and a message from 2006 states the same error, but with
no answers. I think that is a dumb error, but the question remains: there is
something else I must do? The steps I followed where:

1 - Make a class that implements I_CmsScheduledJob;
2 - Package it in a jar and put this jar on the "common/lib" Tomcat folder;
3 - Restart Tomcat;

After this steps, I got the error above (and the class does not appear at
the "Scheduled Jobs" Administration panel combo). The code that does the
scheduling is as follows:

CmsScheduledJobInfo csji = new CmsScheduledJobInfo();
        CmsScheduleManager csm = new CmsScheduleManager();
        csm.initialize(cmsObject);

        CmsContextInfo cci = new CmsContextInfo(cmsJspBean.getRequestContext
());

        csji.setCronExpression(getCronExpression());
        csji.setClassName("br.portalconhecimento.scheduling.PJob");

        csji.setActive(true);
        csji.setContextInfo(cci);
        csji
                .setJobName(new StringBuilder("PAnalysis[").append(
                        cmsUser.getId()).append("][").append(cmsVfsFileURL)
                        .append("][").append(
                                new SimpleDateFormat(DATE_FORMAT_BR)
                                        .format(new Date())).toString());

        SortedMap parametros = new TreeMap();
        parametros.put(PJob.PARAM_USER, cmsUser);
        parametros.put(PJob.PARAM_FILE, cmsVfsFileURL);
        parametros.put(PJob.PARAM_NOTIFY_END_OF_JOB, notifyEndOfJob);

        csji.setParameters(parametros);

        csm.scheduleJob(cmsObject, csji);

Has someone a clue?

TIA,

Celio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080112/3c8de1e5/attachment.htm>


More information about the opencms-dev mailing list