开发者

Issues starting Jenkins

开发者 https://www.devze.com 2023-02-20 13:37 出处:网络
The other night I took a stab at getting Hudson up and running on an EC2 instance. Everything was running fine and dandy until this morning when I created an AMI based on what I had created. Doing tha

The other night I took a stab at getting Hudson up and running on an EC2 instance. Everything was running fine and dandy until this morning when I created an AMI based on what I had created. Doing that also created a snapshot of my drive.

After that I realized that my Jenkins server wasn't running. Sure enough, looking at my ssh instance, I had been disconnected. So I logged back in and tried to start things up by running Jenkins server and this is what I got for an error:

/home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1064:in `escape': can't convert Pathname to String (TypeError)
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1064:in `block in loaded_path?'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1063:in `each'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1063:in `find'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/rub开发者_StackOverflowy/site_ruby/1.9.1/rubygems.rb:1063:in `loaded_path?'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/httparty-0.6.1/lib/httparty.rb:10:in `<top (required)>'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins/api.rb:1:in `<top (required)>'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins.rb:3:in `<module:Jenkins>'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins.rb:1:in `<top (required)>'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/bin/jenkins:4:in `<top (required)>'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/bin/jenkins:19:in `load'
    from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/bin/jenkins:19:in `<main>'

I did use a walkthrough to get this setup, and have referenced back to it to see if missed something, but it's pretty straight forward. I've googled for the can't convert Pathname to String with no luck as well. I honestly have no clue where to even start looking into this one. Is it a Ruby issue? Rails? Jenkins?

I'll update this if i find any other useful info.

EDIT I should also add that I did go into the workspace of the project that I had Jenkins building and was able to start it up just fine. Because of that I don't think this is a Ruby issue.

EDIT 2 Ok, so I decided to take EC2 out of the equation and brought up my own server with Ubuntu 10.10. Same setup, everything worked great, then I rebooted, and now I get this error again. Now I'm confident it's a simple silly mistake due to me being a relative Ubuntu newb, but I'm sure someone else has ran into this before.


For a quick fix, try downgrading rubygems to less than 1.6. Looks like the rubygems devs introduced some code to avoid loading a file more than once.

If you're interested, here's the offending code (from https://github.com/rubygems/rubygems.git at rev dcfba4e1de4c7388425eb5de5066cb5aa9bea6e6):

def self.loaded_path? path
  # TODO: ruby needs a feature to let us query what's loaded in 1.8 and 1.9
  $LOADED_FEATURES.find { |s|
    s =~ /(^|\/)#{Regexp.escape path}#{Regexp.union(*Gem.suffixes)}$/
  }
end

If you're unable to downgrade, a less ideal solution is to edit rubygems.rb so

Regexp.escape path

becomes

Regexp.escape path.to_s


Long story short, the solution was to install Jenkins as apt-get instead of using the Gem. It appears that it came down to an issue where Jenkins was looking at the wrong version of Ruby.

This URL is what ultimately got me started down the path to fix this: http://www.ygamretuta.com/2011/03/ruby-installing-ramaze-working-around-cant-convert-pathname-to-string-error/

I should also add that although the answers that Kelvin gave may have gotten me around the error, neither were ideal solutions to the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号