Forum: JRuby Cucumber error while calling jruby script

02ee2ff9234924331adcb4845754e75e?d=identicon&s=25 Muthu Selvan SR (Guest)
on 2013-06-28 23:37
(Received via mailing list)
Hi All ,

I am getting the below error while calling jruby code ..

But without jruby my cucumber is working fine , please let me know how
to
call jruby code from cucumber  ?

mselv2m1:nikeplus-running-ios mselv2$ cucumber features/java.feature
no such file to load -- java (LoadError)
/Users/mselv2/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
/Users/mselv2/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
/Users/Shared/Development/NikeBuild/nikeplus-running-ios/features/step_definitions/first_call.rb:1
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/rb_support/rb_language.rb:122:in
`load'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/rb_support/rb_language.rb:122:in
`load_code_file'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime/support_code.rb:180:in
`load_file'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime/support_code.rb:83:in
`load_files!'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime/support_code.rb:82:in
`each'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime/support_code.rb:82:in
`load_files!'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime.rb:183:in
`load_step_definitions'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime.rb:42:in
`run!'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/cli/main.rb:47:in
`execute!'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/cucumber:13
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/bin/cucumber:19:in `load'
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/bin/cucumber:19
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/bin/ruby_noexec_wrapper:14
mselv2m1:nikeplus-running-ios mselv2$



Thanks ,
Muthu Selvan SR
Da7e5a2c5b1bd8139704db94b37e068d?d=identicon&s=25 Joshua Ballanco (Guest)
on 2013-06-29 09:04
(Received via mailing list)
Your "cucumber" binary is pointing at Ruby-1.8.7 or you haven't switched
your RVM to point to JRuby. You can tell this is the case by the fact
that your backtrace is pointing at locations for "ruby-1.8.7-p371".
Either switch to jruby in RVM, or if you have JRuby installed separately
from RVM you can always use: jruby -S cucumber features/java.feature

- Josh
02ee2ff9234924331adcb4845754e75e?d=identicon&s=25 Muthu Selvan SR (Guest)
on 2013-06-29 19:21
(Received via mailing list)
Yes , As you said cucumber is pointing to 1.8.7 ,so i have pointed RVM
to
point JRuby with the below command but getting the error

mselv2m1:nikeplus-running-ios mselv2$ export JRUBY_OPTS="--1.9"
mselv2m1:nikeplus-running-ios mselv2$ jruby -S cucumber
features/java.feature
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:8
warning: already initialized constant LexerNotFound
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:8
warning: already initialized constant LexerNotFound
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:8
warning: already initialized constant LexerNotFound
LoadError: no such file to load -- gherkin
      require at org/jruby/RubyKernel.java:1054
      require at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36
  native_impl at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/native/java.rb:25
         I18n at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:9
      Gherkin at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:6
       (root) at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:5
      require at org/jruby/RubyKernel.java:1054
       (root) at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1
      require at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36
      require at org/jruby/RubyKernel.java:1054
       (root) at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2
       (root) at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1
      require at org/jruby/RubyKernel.java:1054
      require at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36
       (root) at
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin.rb:1
      require at org/jruby/RubyKernel.java:1054
       (root) at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:1
      require at
/usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:60
         load at org/jruby/RubyKernel.java:1073
       (root) at /Users/mselv2/.rvm/gems/ruby-1.8.7-p371/bin/cucumber:19
mselv2m1:nikeplus-running-ios mselv2$

any thing should i do more to prevent this error ?

Thanks ,
Muthu Selvan SR




On Sat, Jun 29, 2013 at 12:03 AM, Joshua Ballanco <
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 Christian MICHON (Guest)
on 2013-06-29 22:08
(Received via mailing list)
Uninstall ruby-1.8.7?

I'm being serious here, not really joking: beside the startup time
slower in jruby, you'll not regret the _full_ switch to jruby.



On 6/29/13, Muthu Selvan SR <pearl.selvan@gmail.com> wrote:
>
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:8
>
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:6
>        (root) at
> /usr/local/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:60
>
>> you can always use: jruby -S cucumber features/java.feature
>>
>>
/Users/Shared/Development/NikeBuild/nikeplus-running-ios/features/step_definitions/first_call.rb:1
>>
/Users/mselv2/.rvm/gems/ruby-1.8.7-p371/gems/cucumber-1.3.2/bin/../lib/cucumber/runtime/support_code.rb:82:in
>> /Users/mselv2/.rvm/gems/ruby-1.8.7-p371/bin/ruby_noexec_wrapper:14
>> mselv2m1:nikeplus-running-ios mselv2$
>>
>>
>>
>> Thanks ,
>> Muthu Selvan SR
>>
>>
>>
>


--
Christian
02ee2ff9234924331adcb4845754e75e?d=identicon&s=25 Muthu Selvan SR (Guest)
on 2013-06-30 01:32
(Received via mailing list)
No , I did't uninstall ruby 1.8.7 ...

Please let me know what should i do now ? i did't get you point in your
mail ..

Christian MICHON >> beside the startup time
slower in jruby, you'll not regret the _full_ switch to jruby.

Thanks ,
Muthu Selvan SR


On Sat, Jun 29, 2013 at 1:06 PM, Christian MICHON <
40e5e9fe36a1f85166493faac2c17499?d=identicon&s=25 Hirotsugu Asari (Guest)
on 2013-06-30 03:40
(Received via mailing list)
On Jun 29, 2013, at 7:29 PM, Muthu Selvan SR <pearl.selvan@gmail.com>
wrote:

> No , I did't uninstall ruby 1.8.7 ...
>
> Please let me know what should i do now ? i did't get you point in your mail ..

Since you're using rvm, the fastest way to get it working is:

rvm install jruby-1.7.4 # if you haven't done it already
rvm use jruby
02ee2ff9234924331adcb4845754e75e?d=identicon&s=25 Muthu Selvan SR (Guest)
on 2013-06-30 05:23
(Received via mailing list)
Thanks Hirostsugu , i have tried with your command ..but this time its
different error as in below ...

*$ rvm use jruby*
Using /Users/mselv2/.rvm/gems/jruby-1.7.4


*# Command *
mselv2m1:nikeplus-running-ios mselv2$ jruby -S cucumber
features/java.feature

*Error :*
Gem::LoadError: Could not find cucumber (>= 0) amongst []
  to_specs at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/dependency.rb:247
   to_spec at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/dependency.rb:256
       gem at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems.rb:1231
    (root) at /usr/bin/cucumber:18

Please let me know is any thing required to install ..?

Thanks ,
Muthu Selvan SR
C983ad33b47479f17a28e083e1bb3d8b?d=identicon&s=25 Eric West (edubkendo)
on 2013-06-30 08:49
Yes, now you need to actually install cucumber into jruby, since your
earlier copy of the gem was installed into MRI.
302c6c56b99912a673f1213b0709c902?d=identicon&s=25 Alex Tambellini (Guest)
on 2013-07-02 01:38
(Received via mailing list)
You probably need to install the cucumber gem by running:

gem install cucumber
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-07-02 02:10
(Received via mailing list)
Muthu -

rvm will manage a separate set of gems for each Ruby you install, so
you'll have to install any gems you need for JRuby. If 'rvm jruby' does
not work for you, I recommend creating aliases for easier use, such as:

rvm alias create jruby jruby-1.7.4

Then you can more easily switch to JRuby, with:

rvm jruby

With JRuby the current Ruby by doing the above, you then gem install
whatever you need, such as:

gem install cucumber

- Keith

---
Keith R. Bennett
http://about.me/keithrbennett
40e5e9fe36a1f85166493faac2c17499?d=identicon&s=25 Hirotsugu Asari (Guest)
on 2013-07-02 02:24
(Received via mailing list)
On Jun 29, 2013, at 11:21 PM, Muthu Selvan SR <pearl.selvan@gmail.com>
wrote:

> Gem::LoadError: Could not find cucumber (>= 0) amongst []
>   to_specs at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/dependency.rb:247
>    to_spec at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/dependency.rb:256
>        gem at
/Users/mselv2/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems.rb:1231
>     (root) at /usr/bin/cucumber:18
>
> Please let me know is any thing required to install ..?
>
> Thanks ,
> Muthu Selvan SR

You don't have cucumber installed for jruby, then.

  rvm use jruby
  gem install cucumber

Note that rvm does not share gems across Ruby runtimes.

I suggest reading up on how RVM works. http://rvm.io/
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.