最近本机 script/server 运行出错的朋友请进
案例:
最近gem update有一系列更新, 分别为:
php?name=rails" onclick="tagshow(event)" class="t_tag">rails-1.2.4
activesupport-1.4.3
soap4r-1.5.8
上午更新后运行 script/server 出现以下错误
test $./script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.3/lib/active_support/dependencies.rb:477:in `const_missing': uninitialized constant XSD::NS::KNOWN_TAG (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/ns.rb:18
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.3/lib/active_support/dependencies.rb:495:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.3/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.3/lib/active_support/dependencies.rb:495:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/generator.rb:10
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
... 73 levels...
from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.4/lib/commands/server.rb:39
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from ./script/server:3
原因:
Ruby 内置的soap4r 1.5.5 同更新后的 soap4r 1.5.8有冲突
解决方案:
1. 把soapr设置回1.5.7
test $sudo gem uninstall soap4r --version 1.5.8
Successfully uninstalled soap4r version 1.5.8
test $gem list soap4r
*** LOCAL GEMS ***
soap4r (1.5.7)
An implementation of SOAP 1.1 for Ruby.
2.在rails app里config下面的environment.rb的最上面加入以下几行强制ruby运行soap4r-1.5.8
require 'rubygems'
gem 'soap4r'
月底放出的soap4r-1.5.9更新将会解决这个问题