简体   繁体   English

Jruby:无法在 jruby on rails 应用程序中启动 webrick 服务器

[英]Jruby: Not able to start webrick server in jruby on rails application

I have install jruby 1.7.16 and rails 4.1.8 on my ubuntu machine.我已经在我的 ubuntu 机器上安装了 jruby 1.7.16 和 rails 4.1.8。 i have existing jruby application which i want to run using webbrick server but i am not able to run it.我有现有的 jruby 应用程序,我想使用 webbrick 服务器运行它,但我无法运行它。 whenever i start webrick server using command rails si am getting below error.每当我使用 command rails si 启动 webrick 服务器时,都会出现以下错误。

successful load of fcntl
Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-jdbc-adapter'.
Gem Load Error is: private method `require' called for Kernel:Module
Backtrace for gem load error is:
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:91:in `require'
org/jruby/RubyArray.java:1613:in `each'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:86:in `require'
org/jruby/RubyArray.java:1613:in `each'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:75:in `require'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler.rb:106:in `require'
/home/administrator/Desktop/vitality_iq_project/analytics-core/config/application.rb:19:in `(root)'
org/jruby/RubyKernel.java:1065:in `require'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:1:in `(root)'
org/jruby/RubyKernel.java:1880:in `tap'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79:in `server'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
/home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
org/jruby/RubyKernel.java:1065:in `require'
script/rails:6:in `(root)'
Bundler Error Backtrace:

       require at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:95
          each at org/jruby/RubyArray.java:1613
       require at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:86
          each at org/jruby/RubyArray.java:1613
       require at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler/runtime.rb:75
       require at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/bundler-1.13.1/lib/bundler.rb:106
        (root) at /home/administrator/Desktop/vitality_iq_project/analytics-core/config/application.rb:19
       require at org/jruby/RubyKernel.java:1065
        (root) at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:1
           tap at org/jruby/RubyKernel.java:1880
        server at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:79
        server at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76
  run_command! at /home/administrator/.rvm/gems/jruby-1.7.16@analytics-core/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40
       require at org/jruby/RubyKernel.java:1065
        (root) at script/rails:6

Below is my jruby version information下面是我的 jruby 版本信息

jruby -v
jruby 1.7.16 (1.9.3p392) 2014-09-25 575b395 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_101-b13 +jit [linux-amd64]

and my rails version is 4.1.8 .我的 rails 版本是 4.1.8 。 please help me to start server in Jruby application with rails.请帮助我使用 rails 在 Jruby 应用程序中启动服务器。

Thanks,谢谢,

there's an issue with Bundler 1.13.1 that is causing this - basically they transplant the require method while in JRuby 1.7 a visibility bug thus makes Kernel::require private. Bundler 1.13.1 有一个问题导致了这个问题——基本上他们移植了require方法,而在 JRuby 1.7 中,一个可见性错误因此使Kernel::require私有。

3 thing you could do :你可以做的三件事:

  1. change Kernel.require visibility to be public (after Bundler is loaded)将 Kernel.require 可见性更改为公开(加载 Bundler 后)
  2. downgrade to Bundler 1.12降级到 Bundler 1.12
  3. upgrade to JRuby 1.7.26 (not yet released)升级到 JRuby 1.7.26(尚未发布)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM