Uploaded image for project: 'TorqueBox'
  1. TorqueBox
  2. TORQUE-1218

superclass mismatch for class error when a Job class is a subclass

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: 4.0.0
    • Component/s: Jobs
    • Labels:
      None

      Description

      If we create a class intended to be run as a scheduled job, and it is a subclass, then after seeming to run successfully the first time we receive an error on subsequent invocations stating: superclass mismatch for class

      Error log is below:

      13:09:03,470 INFO  [org.torquebox.core.runtime] (pool-7-thread-1) Created ruby runtime (ruby_version: RUBY1_9, compile_mode: JIT, app: adaptiq, context: jobs) in 8.9s
      13:09:15,320 ERROR [stderr] (jboss.deployment.unit."adaptiq-knob.yml".job_scheduler_Worker-2) TestJob run: 2014-05-09 13:09:15 +1000
      13:09:45,295 INFO  [org.quartz.core.JobRunShell] (jboss.deployment.unit."adaptiq-knob.yml".job_scheduler_Worker-3) Job adaptiq-knob.yml.test_job threw a JobExecutionException: : org.quartz.JobExecutionException: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob [See nested exception: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob]
              at org.torquebox.jobs.RubyJobProxy.execute(RubyJobProxy.java:70)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz.jar:]
      Caused by: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob
              at RUBY.(root)(/Users/SeanM/projects/adaptiq/app/services/test_job.rb:1)
      13:10:15,295 INFO  [org.quartz.core.JobRunShell] (jboss.deployment.unit."adaptiq-knob.yml".job_scheduler_Worker-1) Job adaptiq-knob.yml.test_job threw a JobExecutionException: : org.quartz.JobExecutionException: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob [See nested exception: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob]
              at org.torquebox.jobs.RubyJobProxy.execute(RubyJobProxy.java:70)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz.jar:]
      Caused by: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob
              at RUBY.(root)(/Users/SeanM/projects/adaptiq/app/services/test_job.rb:1)
      13:10:45,292 INFO  [org.quartz.core.JobRunShell] (jboss.deployment.unit."adaptiq-knob.yml".job_scheduler_Worker-2) Job adaptiq-knob.yml.test_job threw a JobExecutionException: : org.quartz.JobExecutionException: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob [See nested exception: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob]
              at org.torquebox.jobs.RubyJobProxy.execute(RubyJobProxy.java:70)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz.jar:]
      Caused by: org.jruby.exceptions.RaiseException: (TypeError) superclass mismatch for class TestJob
              at RUBY.(root)(/Users/SeanM/projects/adaptiq/app/services/test_job.rb:1)
      

      The code I used to replicate the error above is:

      app/services/test_job.rb
      class TestJob < TestJobParent
        def run 
          $stderr.puts "TestJob run: #{Time.zone.now}"
        end 
      end
      
      app/services/test_job_parent.rb
      class TestJobParent; end
      

      The job was scheduled using

      TorqueBox::ScheduledJob.at('TestJob', name: 'test_job', every: 30_000)
      

      It appears the issue can be mitigated by explicitly doing a require for the parent class, e.g.

      app/services/test_job.rb
      require Rails.root.join('app/services/test_job_parent')
      
      class TestJob < TestJobParent
        def run 
          $stderr.puts "TestJob run: #{Time.zone.now}"
        end 
      end
      

      However this require should not be necessary.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                seandmccarthy Sean McCarthy
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: