ruby on rails-延迟作业给出未定义的方法错误



Delayed job(2.1.4)在我的开发机器上运行得很好,可以随意发送电子邮件,但在我的服务器上使用Apache/Paccer(3.0.7)运行时却失败得很惨。Rails 3.0.7和ruby 1.9.2都在btw上。

我已经看到,在使用thin时有一个问题,其中创建的作业是这样的:

--- !ruby/struct:Delayed::PerformableMailer
object: !ruby/object:Class UserMailer

什么时候应该读:

--- !ruby/struct:Delayed::PerformableMailer
object: !ruby/class UserMailer 

我的是在我的开发机器上正确创建的,但在服务器上创建的方式是错误的。

其他人有这个问题吗?我应该从哪里开始寻找?

Stacktrace:

{undefined method `standard_message' for #<Class:0xc6ad054>
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/performable_mailer.rb:6:in `perform'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:87:in `invoke_job'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block (2 levels) in run'n
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:57:in `timeout'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block in run'n
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:119:in `run'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:177:in `reserve_and_run_one_job'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:104:in `block in work_off'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `times'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `work_off'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:78:in `block (2 levels) in start'n
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:77:in `block in start'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `loop'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `start'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:104:in `run'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:83:in `block in run_process'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `call'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `block in start_proc'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/daemonize.rb:199:in `call'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/daemonize.rb:199:in `call_as_daemon'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:253:in `start_proc'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:293:in `start'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/controller.rb:70:in `run'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:195:in `block in run_proc'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `call'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `catch_exceptions'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:194:in `run_proc'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:81:in `run_process'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:75:in `block in daemonize'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `times'n
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `daemonize'n
script/delayed_job:5:in `<main>'

我已经设法解决了这个问题。

几周前,当bundler由于某种原因停止工作时,我创建了一个setup_load_paths.rb。这意味着除了乘客外,所有地方都在装载gemfile。这把对YAML::ENGINE.yamler="syck"的调用搞砸了,这似乎就是把保存对象搞砸的原因。

我删除了setup_load_path,现在一切都很好。

如果使用Syck解析器似乎不起作用(就像Marc的回答中提到的那样),请尝试使用psych解析器。

YAML::ENGINE.yamler = "psych"

相关内容

  • 没有找到相关文章

最新更新