1
votes

I created map_job.rb in project lib folder. But why I am getting this error when delayed job.

  • error message

    "last_error": "Job failed to load: undefined class/module MapJob. Handler: \"--- !ruby/struct:MapJob\nid: aa\n\"\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:87:in rescue in payload_object'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:85:inpayload_object'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in block in invoke_job'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:incall'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in block in initialize'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:incall'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in execute'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:inrun_callbacks'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in invoke_job'\n(eval):3:inblock in invoke_job_with_newrelic_transaction_trace'\n/app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.9.2.239/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:365:in perform_action_with_newrelic_trace'\n(eval):2:ininvoke_job_with_newrelic_transaction_trace'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:203:in block (2 levels) in run'\n/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:69:intimeout'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:203:in block in run'\n/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:inrealtime'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:202:in run'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:259:inblock in reserve_and_run_one_job'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:inblock in initialize'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:inexecute'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in run_callbacks'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:259:inreserve_and_run_one_job'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:187:in block in work_off'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:186:intimes'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:186:in work_off'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:151:inblock (4 levels) in start'\n/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in realtime'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:150:inblock (3 levels) in start'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:inblock in initialize'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:inexecute'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in run_callbacks'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:149:inblock (2 levels) in start'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:148:in loop'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:148:inblock in start'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:7:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:7:inblock (2 levels) in '\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:inblock (2 levels) in add'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:inblock in initialize'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:inblock in add'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in call'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:inexecute'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:in run_callbacks'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:147:instart'\n/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/tasks.rb:9:in block (2 levels) in <top (required)>'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:240:incall'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:240:in block in execute'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:235:ineach'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:235:in execute'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:179:inblock in invoke_with_call_chain'\n/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:172:ininvoke_with_call_chain'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/task.rb:165:in invoke'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:150:ininvoke_task'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:in block (2 levels) in top_level'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:ineach'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:106:in block in top_level'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:115:inrun_with_threads'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:100:in top_level'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:78:inblock in run'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in standard_exception_handling'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:inrun'\n/app/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in <top (required)>'\n/app/vendor/bundle /ruby/1.9.1/bin/rake:23:inload'\n/app/vendor/bundle/ruby/1.9.1/bin/rake:23:in `'",

Please help me. Any help would be greatly appreciated!

2

2 Answers

1
votes

You need to autoload map_job.rb

Do this in your application.rb file and restart your server.

require "#{Rails.root.to_s}/lib/map_job.rb"
0
votes

Do you have a class/Module named MapJob in your map_job.rb file?. The Error complains that you have not defined a class/module with that name