Results 1 to 4 of 4

Thread: 3.1.M2 + Quartz 2: Errors on new AdaptableJobFactory changes?

  1. #1

    Default 3.1.M2 + Quartz 2: Errors on new AdaptableJobFactory changes?

    Yes, I know, spring does not collaborate with Quartz 2.0. But, Juergen Hoeller made a change to at least AdaptableJobFactory works with it in Spring 3.1.M2. Thank you, Jürgen! The small Changeset: https://fisheye.springsource.org/cha...mework?cs=4375

    But: That change does not work for me. I'm getting a IncompatibleClassChangeError. The source is here in AdaptableJobFactory on createJobInstance:

    PHP Code:
    protected Object createJobInstance(TriggerFiredBundle bundlethrows Exception {
        return 
    bundle.getJobDetail().getJobClass().newInstance();

    Strange: In Eclipse debugger I can watch the result from newInstance(), which gives me my Object, which is a JobDetail-Class Instance, which implements the Job interface.
    Exception text: Found interface org.quartz.JobDetail, but class was expected.
    Calls which fires job creation:
    PHP Code:
    JobDetail job org.quartz.JobBuilder.newJob(MyJob.class). ... .build();
    scheduler.scheduleJob(jobtrg); 
    Signature of MyJob:
    PHP Code:
    public class MyJob implements Job {...} 
    Versions: Spring 3.1.M2, Quartz 2.0.2 (from Maven), Java 6, OS X
    Last edited by sja; Jul 14th, 2011 at 04:39 AM. Reason: 3.2 -> 3.1
    Spring 3.X, Web Flow 2.X, Java 6, STS 2.7.0, Maven, OS X

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,806

    Default

    Hello

    Post the complete error stack trace to get a clear idea about the case

    If you are totally sure that you are using the same frameworks and specifically the same version release used by Jürgen and you followed his instructions, you perhaps found out a a bug and a JIRA issue would be consider it
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3

    Default

    Ok, I'm very sure, that I use the same Versions, because I got them from Maven, I see the Code and it's the same than in the Changeset.

    Here's my StackTrace:

    PHP Code:
    10:29:35  DEBUG my.project.scheduler.amqp.ConfigMessageHandler Starting dispatcher for Message my.project.scheduler.amqp.messages.ConfigMessage@4d811e2c
    10
    :29:35  TRACE my.project.scheduler.amqp.HostHandler Handling configMessage!
    10:29:35  INFO  my.project.scheduler.amqp.HostHandler Created new Host check for host devl.intranet
    10
    :29:35  ERROR org.quartz.core.ErrorLogger An error occured instantiating job to be executedjob'HostChecks.1-check1'
    org.quartz.SchedulerExceptionProblem instantiating class 'my.project.scheduler.jobs.ReachableCheckJob' -  [See nested exceptionjava.lang.IncompatibleClassChangeErrorFound interface org.quartz.JobDetailbut class was expected]
        
    at org.quartz.core.JobRunShell.initialize(JobRunShell.java:141)
        
    at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:381)
    Caused byjava.lang.IncompatibleClassChangeErrorFound interface org.quartz.JobDetailbut class was expected
        at org
    .springframework.scheduling.quartz.AdaptableJobFactory.createJobInstance(AdaptableJobFactory.java:68)
        
    at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:51)
        
    at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:43)
        
    at org.quartz.core.JobRunShell.initialize(JobRunShell.java:134)
        ... 
    1 more
    10
    :29:35  INFO  org.springframework.scheduling.quartz.LocalDataSourceJobStore All triggers of Job HostCheckTrigger.HLMonTrigger-1-check1 set to ERROR state
    HostHandler:
    PHP Code:
    void handleHostAction(ConfigMessage configMessage) {
            
    Assert.isTrue(configMessage.getTarget().equals(TargetObject.HOST));
            
    logger.trace("Handling configMessage!");

            
    GenericConfig config configMessage.getConfigObject();
            
    Map<StringObjectconfigMap config.getConfigMap();
            final 
    String checkName = (String) configMap.get("name");
            final 
    String hostname = (String) configMap.get("hostname");
            switch (
    configMessage.getAction()) {
            case 
    UPDATE:
                
    logger.debug("UPDATE " configMap);
                break;
            case 
    CREATE:
                try {
                    
    int interval Integer.parseInt((String) configMap.get("interval"));

                    
    JobDetail job newJob(ReachableCheckJob.class).withIdentity(checkName"HostChecks").storeDurably()
                            .
    requestRecovery().usingJobData("hostname"hostname).build();

                    
    Trigger trg newTrigger().withIdentity("MonTrigger-" checkName"HostCheckTrigger").startNow()
                            .
    forJob(job).withSchedule(simpleSchedule().withIntervalInSeconds(interval).repeatForever())
                            .
    build();

                    
    scheduler.scheduleJob(jobtrg);
                    
    logger.info("Created new Host check for hot " hostname);

                } catch (
    Exception e) {
                    
    logger.error("Could not create or update!");
                    
    logger.debug("Host Data: " configMape);
                }
                break;
            case 
    DELETE:
                try {
                    
    logger.debug("DELETE " configMap);
                } catch (
    Exception e) {
                    
    logger.error("Could not delete!");
                    
    logger.debug("Calendar name to delete: " checkNamee);
                }
                break;
            default:
                throw new 
    IllegalArgumentException("Could not handle not yet implemented Action:"
                        
    configMessage.getAction());
            } 
    Legend:
    ConfigMessageHandler: Dispatches ConfigMessage Beans received by AMQP to Special Handlers, e.g. HostHandler
    Last edited by sja; Jul 18th, 2011 at 03:49 AM. Reason: updated code
    Spring 3.X, Web Flow 2.X, Java 6, STS 2.7.0, Maven, OS X

  4. #4

    Default

    Juergen Hoeller answered in Jira:
    Good catch - the fix in 3.1 M2 was incomplete. I've fixed this for 3.1 RC1, as part of a general Quartz 2.0 update: Except for JobDetailBean and the TriggerBeans, the entire Spring Quartz support is compatible with Quartz 2.0 now (making quite heavy use of reflection internally), while at the same time remaining compatible with Quartz 1.5+.
    Juergen
    The Changeset is here:
    https://fisheye.springsource.org/cha...obFactory.java
    Last edited by sja; Jul 20th, 2011 at 02:58 AM. Reason: added changeset url
    Spring 3.X, Web Flow 2.X, Java 6, STS 2.7.0, Maven, OS X

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •