Failed to set rails using jRuby

I am trying to set rails using jRuby with the following command

jruby -S gem install rails -v 3.0.6

But stuck with an error:

JRuby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl for full support. System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException from DefaultResolver.java:111:in `makeTime' from DefaultResolver.java:277:in `create' from DefaultResolver.java:317:in `handleScalar' from DefaultResolver.java:435:in `orgHandler' from DefaultResolver.java:455:in `node_import' from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import .gen:65535:in `call' from CachingCallSite.java:146:in `call' from RubyLoadHandler.java:40:in `handle' from Parser.java:300:in `addNode' from DefaultYAMLParser.java:676:in `yyparse' from Parser.java:290:in `yechtparse' from Parser.java:284:in `parse' from YParser.java:152:in `load' from org/yecht/ruby/YParser$s_method_0_1$RUBYINVOKER$load.gen:65535:in ` call' from JavaMethod.java:630:in `call' from DynamicMethod.java:186:in `call' from CachingCallSite.java:309:in `cacheAndCall' from CachingCallSite.java:148:in `call' from CallOneArgNode.java:57:in `interpret' from LocalAsgnNode.java:123:in `interpret' from NewlineNode.java:104:in `interpret' from InterpretedMethod.java:180:in `call' from DefaultMethod.java:174:in `call' from CachingCallSite.java:309:in `cacheAndCall' from CachingCallSite.java:148:in `call' from CallOneArgNode.java:57:in `interpret' from LocalAsgnNode.java:123:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedMethod.java:180:in `call' from DefaultMethod.java:174:in `call' from CachingCallSite.java:309:in `cacheAndCall' from CachingCallSite.java:148:in `call' from CallOneArgNode.java:57:in `interpret' 

Anyone can help me avoid this error.

Thanks in advance.

+7
source share
3 answers

I had this problem a little bit back, but it was with rspec . Try the following:
jruby --1.9 -S gem install rails -v 3.0.6

This tells jruby to use the ruby ​​1.9 interpreter.

+6
source

This bug has been fixed in JRuby 1.6.2.

Workaround for JRuby 1.6.1 on the command line (Windows):

 set JRUBY_OPTS=--1.9 # in your specific case gem install rails # this is where I got the error (Rails 3 with Bundler) bundle update 
+4
source

This error may occur with some versions of the gem you are installing, but not with others. This is because the YAML error is related to the date field in the YAML file, as indicated in this comment for error 5581 .

For example, version 1.4.2 of the biographer caused an exception for me.

Instructions on how to get metadata apply to YAML Yak Shave , except that I replaced gunzip and less for gzcat

 gem fetch bio --version 1.4.2 tar xvf bio-1.4.2.gem gunzip metadata.gz less metadata | grep date date: 2011-08-26 00:00:00.000000000 Z YAML.load("date: 2011-08-26 00:00:00.000000000 Z") # Causes exception 

whereas for version 1.4.1 bio

 gem fetch bio --version 1.4.1 tar xvf bio-1.4.1.gem gunzip metadata.gz less metadata | grep date date: 2010-10-22 00:00:00 +09:00 YAML.load("date: 2010-10-22 00:00:00 +09:00") # Doesn't cause an exception 

So sudo jruby -S gem install bio --version 1.4.1 worked for me.

If you want the latest and greatest, you can get the gem, change its metadata or build the gem yourself, but for me it was a good Enough β„’.

0
source

All Articles