标签: jruby

在jruby上安装宝石

我曾与ruby和ROR合作,但这个新项目要求我使用jruby.我得到了文档广告,它要求我安装jgem安装黄瓜,等..

我在Ubuntu 10.10上这样做

我不明白jgem部分.

我做了一些研究并试图通过以下方式安装它: jruby -S gem install cucumber

得到了输出:

JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
ERROR:  While executing gem ... (SystemCallError)
    Unknown error - mkdir failed
Run Code Online (Sandbox Code Playgroud)

我尝试安装:gem install jruby-openssl 并得到了相同的结果

ruby gem rubygems ruby-on-rails jruby

4
推荐指数
2
解决办法
5994
查看次数

无法在JRuby中安装therubyracer

我已经安装了RVM,然后安装了Jruby,这是我输入的版本:jruby -v:

jruby 1.6.5.1(ruby-1.8.7-p330)(2011-12-27 1bf37c2)(Java HotSpot(TM)Client VM 1.7.0_02)[linux-i386-java]

问题是我无法安装therubyracer gem,当我尝试通过jruby -S gem install therubyracer安装时,我得到了这个:

/usr/local/rvm/rubies/jruby-1.6.5.1/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very we$
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
Checking for Python...Unable to build libv8: Python not found!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include …
Run Code Online (Sandbox Code Playgroud)

ruby linux jruby rvm

4
推荐指数
1
解决办法
4958
查看次数

用Ubuntu安装JRuby 1.6.7 + Rails 3?

在Ubuntu上安装JRuby 1.6.7和Rails 3的博客或教程?

jruby jrubyonrails

4
推荐指数
1
解决办法
3089
查看次数

JRuby:Watir在启动浏览器时挂起

我有Windows 7企业版,我正在尝试运行JRuby.我为Ruby(1.9.3),Java(jdk - 1.6.7)和JRuby(1.7preview)设置了我的环境变量.我有一个网络驱动器,但我创建了一个HOME系统变量似乎正在工作,因为我可以成功下载Ruby和JRuby的宝石,并将它们保存到我的本地驱动器.

当我尝试启动浏览器(即firefox,chrome)时,似乎挂起了JRuby,但不是Ruby.以下是JRuby尝试执行10分钟后的跟踪:

irb(main):003:0> require 'rubygems'
=> false
irb(main):004:0> require 'watir-webdriver'
=> true
irb(main):005:0> b = Watir::Browser.new :ie
IRB::Abort: abort then interrupt! *<--Note I killed the process after 10 minutes*
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common 
    /port_prober.rb:24:in `free?'       
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common  
    /port_prober.rb:5:in `above'        
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/ie/bridge.rb:17:in
   `initialize'
    from org/jruby/RubyHash.java:1429:in `delete'
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/ie/bridge.rb:17:in
    `initialize'
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:3
    5:in `for'
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in `for'
    from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
    /shared/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:35:in   
    `initialize'
    from (irb):5:in `evaluate'
    from org/jruby/RubyKernel.java:1037:in `eval'
    from org/jruby/RubyKernel.java:1353:in `loop'
    from org/jruby/RubyKernel.java:1146:in `catch' …
Run Code Online (Sandbox Code Playgroud)

ruby java jruby watir

4
推荐指数
1
解决办法
1664
查看次数

Gemfile导致扭矩盒env变量变空

我想我发现了一个有关扭矩盒的错误.出于某种原因,如果我"宝石安装扭矩盒"然后在我的Gemfile中添加"宝石'扭矩盒'"线,"torquebox env"就会停止正常工作.这很容易重现,所以如果有人知道发生了什么,请告诉我:

要重现该错误,让我们创建一个新的gemset并安装torquebox-server

$ rvm use jruby-1.6.7.2
$ rvm gemset create test
$ mkdir torquetest
$ cd torquetest
$ rvm use jruby-1.6.7.2@test
Run Code Online (Sandbox Code Playgroud)

让我暂停一下,告诉你我的jruby-1.6.7.2@global中的内容,如果重要的话:

$ ls ~/.rvm/gems/jruby-1.6.7.2@global/gems 
total 0
drwxr-xr-x   9 jstokes   306 Aug  9 16:26 ./
drwxr-xr-x   7 jstokes   238 Aug  9 16:25 ../
drwxr-xr-x   5 jstokes   170 Aug  9 16:25 bouncy-castle-java-1.5.0146.1/
drwxr-xr-x  15 jstokes   510 Aug  9 16:26 bundler-1.1.5/
drwxr-xr-x  34 jstokes  1156 Aug  9 16:25 jruby-launcher-1.0.15-java/
drwxr-xr-x  10 jstokes   340 Aug  9 16:25 jruby-openssl-0.7.7/
drwxr-xr-x  13 jstokes   442 …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails jruby jrubyonrails torquebox

4
推荐指数
1
解决办法
691
查看次数

NameError:无法加载Java类com.mysql.jdbc.Driver

我正在使用JRuby 1.7.2,以及DataMapper,我收到一个错误,我找不到答案.

我只是测试DataMapper和MySQL 5.5,看看它是否会在我构建时运行良好.这是我正在测试的文件:

require "data_mapper"
require "keys"

DataMapper.setup(:default, "mysql://#{$user}:#{$pass}@localhost/test_db")
Run Code Online (Sandbox Code Playgroud)

当我运行这个时,我得到错误:

NameError: cannot load Java class com.mysql.jdbc.Driver
Run Code Online (Sandbox Code Playgroud)

它指向DataMapper.setup行.

我的Gemfile应该没问题:

source :rubygems

gem "sinatra"
gem "trinidad"
gem "data_mapper"

# do a `sudo apt-get install libmysqlclient-dev` first
gem "dm-mysql-adapter"
gem "jdbc-mysql"
Run Code Online (Sandbox Code Playgroud)

有什么我想念的吗?我已经在本地设置了用户/传递的MySQL.

mysql jruby jdbc

4
推荐指数
2
解决办法
4237
查看次数

ruboto app慢启动

演示脚本(由新的应用程序生成器生成的脚本)在我的SGS2上启动大约需要6秒钟.这是一个jRuby税还是我没有正确安装(我假设rake install的方式)?

如果它只是它的方式,那么我想知道一个应用程序是否比其竞争对手长6秒的旋转器对任何人都有任何价值(真正的问题 - 不是拖钓).

android jruby ruboto

4
推荐指数
1
解决办法
1031
查看次数

在JRuby中使用|| =和+ =(jruby-lint警告)

当我在我的(Rails)应用程序上运行jruby-lint时,我会得到以下几个:

非本地运营商分配不保证是原子的

哪个代码看起来像这样:

def foo
  @foo ||= Foo.new
end
Run Code Online (Sandbox Code Playgroud)

或这个:

config.assets.precompile += %w( email/email.css )
Run Code Online (Sandbox Code Playgroud)

其中一些在app /中,其中一些在config /中.我猜这个警告只与左边的东西是一个数组的情况有关,要修复它我应该用Threadsafe::Array吗?

我需要改变哪些类型的这些东西?

ruby jruby thread-safety

4
推荐指数
1
解决办法
238
查看次数

在Ruby中为mutex使用类实例变量

注意:下面显示的代码摘要不是我遇到问题的代码的精华.我已经在这里留下了这个原始摘要,因为其他人已经回答了,但实际的代码显示在我在下面提供的答案中.

我无法将其隔离到一个小的失败的测试用例,但我使用以下一般构造失败了:

class Foo

  @mutex = Mutex.new

  ....

  def self.bar
    @mutex.synchronize { ... }
  end

end
Run Code Online (Sandbox Code Playgroud)

如果我创建多个线程调用Foo.bar,有时@mutex会评估为nilbar.如果我使用常量(例如MUTEX)而不是实例变量,我没有这个问题.

我不知道它是否重要,但我在一台多核机器上运行JRuby.

我很感激如何解决问题的任何解释或帮助.

更新:我认为这与自动加载有关.使用Rails,我能够使用以下foo.rbRails自动加载目录中的以下内容重现类似的问题:

class Foo
  @mutex = Mutex.new
  def self.bar
    @mutex.synchronize {}
  end
end
Run Code Online (Sandbox Code Playgroud)

当我在Rails控制台中执行以下操作时:

1.upto(4).map { Thread.new { Foo.bar }}.map(&:join)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

RuntimeError: Circular dependency detected while autoloading constant Foo
    from /Users/palfvin/.rvm/gems/jruby-1.7.10@javlats/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:461:in `load_missing_constant'
    from /Users/palfvin/.rvm/gems/jruby-1.7.10@javlats/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:184:in `const_missing'
    from (irb):1:in `evaluate'
Run Code Online (Sandbox Code Playgroud)

这个行为在CRuby(MRI Ruby)中是相同的.

ruby synchronization mutex jruby

4
推荐指数
1
解决办法
4077
查看次数

logstash缺少jruby gem

我已经下载了最新的logstash 1.4,当我使用以下配置运行它时:

input {
  eventlog {    
  }
}
output { stdout {} }
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

D:\logstash-1.4.0\bin>logstash agent -f simpleConfig.config -l logs.log
Sending logstash logs to agent.log.
?[33mUsing milestone 2 input plugin 'eventlog'. This plugin should be stable, bu
t if you see strange behavior, please let us know! For more information on plugi
n milestones, see http://logstash.net/docs/1.4.0/plugin-milestones {:level=>:war
n}?[0m
LoadError: no such file to load -- jruby-win32ole
       require at org/jruby/RubyKernel.java:1085
       require at file:/D:/logstash-1.4.0/vendor/jar/jruby-complete-1
.7.11.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.
rb:55
       require at file:/D:/logstash-1.4.0/vendor/jar/jruby-complete-1
.7.11.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.
rb:53
       require …
Run Code Online (Sandbox Code Playgroud)

jruby logstash

4
推荐指数
1
解决办法
1550
查看次数