JRuby和jQuery不能很好地协同工作

时间:2011-02-17 18:47:04

标签: jquery ruby-on-rails jruby

您好我正在使用:

* Mac Os X 10.6.5
* Netbeans 6.9.1 (with embedded JRuby 1.5.1)
* JDK6u17
* GlassFish Gem 1.0.2
* Rails 3.0.3

我想在我的项目中使用jQuery和CKeditor。

安装jquery-rails gem并运行命令

rails g jquery:install

有些事情出错了。

输出:

      remove  public/javascripts/controls.js
      remove  public/javascripts/dragdrop.js
      remove  public/javascripts/effects.js
      remove  public/javascripts/prototype.js
    fetching  jQuery (1.4.3)
   identical  public/javascripts/jquery.js
   identical  public/javascripts/jquery.min.js
    fetching  jQuery UJS adapter (github HEAD)
/Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': load error: rails/commands/generate -- java.lang.NoSuchMethodError: org.jruby.Ruby.getSelectorPool()Lorg/jruby/util/io/SelectorPool; (LoadError)
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:17
    from /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:6:in `require'
    from script/rails:6

知道如何解决这个问题吗? 是否有另一种在Jruby上安装jQuery的方法?

我很感激你的帮助。

1 个答案:

答案 0 :(得分:1)

尝试更新gem ... https://github.com/rails/jquery-ujs,该链接还包含“手动”安装的文档