Ejabberd / Rails“getaddrinfo:提供nodename或servname,或者不知道”

时间:2011-08-02 00:44:59

标签: ruby-on-rails actionmailer ejabberd

我收到错误

SocketError in UsersController#create
getaddrinfo: nodename nor servname provided, or not known

当我尝试在我的rails应用程序中创建帐户时。我认为这个问题与ejabberd或动作邮件有关。如何找到有关此错误来源的更多信息?

这是我的users_controller中的def创建

 def create    
    @user = User.new(params[:user])
    if @user.save!
      clear_current_session
      MailAgent.registration_confirmation(@user).deliver
      flash[:notice] = 'Please activate your account by clicking on the link sent to you by email.'
      redirect_to new_user_url
    else
      flash.now[:error] = 'Please fix the listed errors'
      render 'new'
    end
  end

这是完整的错误

Started GET "/" for 127.0.0.1 at 2011-08-02 10:18:33 +1000
  Processing by PagesController#home as HTML
Redirected to http://localhost:3000/users/new
Completed 302 Found in 0ms


Started GET "/users/new" for 127.0.0.1 at 2011-08-02 10:18:33 +1000
  Processing by UsersController#new as HTML
Rendered users/_signup_form.html.erb (6.5ms)
Rendered layouts/_login_links.html.erb (23.3ms)
Rendered layouts/_error_messages.html.erb (0.3ms)
Rendered users/new.html.erb within layouts/application (33.7ms)
Completed 200 OK in 36ms (Views: 35.6ms | ActiveRecord: 0.2ms)


Started POST "/users" for 127.0.0.1 at 2011-08-02 10:18:49 +1000
  Processing by UsersController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"0JgPvOiu18OjD6TmpUrxDGtPiTUBlw0W78HqtdV/brc=", "user"=>{"name"=>"test", "email"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"}
  [1m[36mSQL (0.1ms)[0m  [1mBEGIN[0m
  [1m[35mUser Load (0.1ms)[0m  SELECT `users`.`id` FROM `users` WHERE (LOWER(`users`.`email`) = LOWER("[FILTERED]")) LIMIT 1
  [1m[36mUser Load (0.1ms)[0m  [1mSELECT `users`.`id` FROM `users` WHERE (`users`.`persistence_token` = BINARY '61b972eee6ed6eb2341b08d92640b08e6379b8743a4df5aa73a233151a6d5629896470e00e108d0f08d20814fb67d8') LIMIT 1[0m
  [1m[35mSQL (1.7ms)[0m  describe `users`
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO `users` (`name`, `email`, `crypted_password`, `password_salt`, `persistence_token`, `perishable_token`, `login_count`, `last_login_at`, `created_at`, `updated_at`, `activated`) VALUES ('test', "[FILTERED]", '37712237698ea6db7f044f9408adee9d1fe02447bdb1b92c34b71d2ca35795dd04af1528aa73b6e7db5b11f', 'JnajFzu5luNXbeU', '61b972ec6e0ee6ed6eb08e6379b8743a448ced73ddf5aa73a233151a6d56298e53a996470e00e108d0f08d20814f9c461185f0b67d8', 'bIPlmXIFPjJDHzt', 1, NULL, '2011-08-02 00:18:49', '2011-08-02 00:18:49', 0)[0m
  [1m[35mJabberCredential Load (0.1ms)[0m  SELECT `jabber_credentials`.* FROM `jabber_credentials` WHERE (`jabber_credentials`.user_id = 12) LIMIT 1
  [1m[36mJabberCredential Load (0.1ms)[0m  [1mSELECT `jabber_credentials`.`id` FROM `jabber_credentials` WHERE (`jabber_credentials`.`jabber_id` = BINARY '12_test_72') LIMIT 1[0m
  [1m[35mSQL (1.3ms)[0m  describe `jabber_credentials`
  [1m[36mAREL (0.1ms)[0m  [1mINSERT INTO `jabber_credentials` (`jabber_id`, `jabber_password`, `user_id`, `created_at`, `updated_at`) VALUES ('12_test_72', '123456', 12, '2011-08-02 00:18:49', '2011-08-02 00:18:49')[0m
  [1m[35mSQL (0.5ms)[0m  ROLLBACK
Completed   in 32093ms

SocketError (getaddrinfo: nodename nor servname provided, or not known):
  lib/xmpp_client.rb:14:in `initialize'
  app/models/user.rb:27:in `new'
  app/models/user.rb:27:in `register_jabber'
  app/models/user_observer.rb:7:in `after_create'
  app/controllers/users_controller.rb:11:in `create'

Rendered /Users/fred/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.6ms)
Rendered /Users/fred/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.4ms)
Rendered /Users/fred/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (4.8ms)

1 个答案:

答案 0 :(得分:0)

检查日志文件,无论何时抛出异常,它都会输出堆栈跟踪。最靠近顶部的线条比较低的线条更相关。许多行将是“错误的错误”,这意味着它们不是问题,但由于问题而失败。需要一些猜测工作和健康的经验来确定哪一个是相关的。

请包括堆栈跟踪,也许我们可以为您提供进一步的帮助。