rubyjs / therubyrhino

Embed the Mozilla Rhino Javascript interpreter into Ruby
155 stars 40 forks source link

NoMethodError: undefined method `setBuiltinProtoAndParent' for Java::OrgMozillaJavascript::ScriptRuntime:Class #18

Closed brutuscat closed 12 years ago

brutuscat commented 12 years ago

When trying to run rails s I got the following error:

NoMethodError: undefined method `setBuiltinProtoAndParent' for Java::OrgMozillaJavascript::ScriptRuntime:Class
          initialize at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/ruby.rb:74
                wrap at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/ruby.rb:66
               cache at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/rhino_ext.rb:222
               cache at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/ruby.rb:216
                wrap at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/ruby.rb:66
       to_javascript at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/wormhole.rb:27
  args_to_javascript at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/wormhole.rb:36
             collect at org/jruby/RubyArray.java:2339
  args_to_javascript at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/wormhole.rb:36
                call at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/rhino_ext.rb:161
                call at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/bundler/gems/less.rb-9d1a24f2e73e/lib/less/java_script/rhino_context.rb:69
             require at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/bundler/gems/less.rb-9d1a24f2e73e/lib/less/loader.rb:47
                Less at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/bundler/gems/less.rb-9d1a24f2e73e/lib/less.rb:15
              (root) at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/bundler/gems/less.rb-9d1a24f2e73e/lib/less.rb:9
             require at org/jruby/RubyKernel.java:1042
             require at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/bundler/gems/less.rb-9d1a24f2e73e/lib/less.rb:68
                each at org/jruby/RubyArray.java:1615
             require at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66
                each at org/jruby/RubyArray.java:1615
             require at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55
             require at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119
              (root) at /Users/mauroasprea/nektra/entretenerse2/config/application.rb:13
             require at org/jruby/RubyKernel.java:1042
              (root) at /Users/mauroasprea/nektra/entretenerse2/config/application.rb:53
                 tap at org/jruby/RubyKernel.java:1787
              (root) at /Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50
             require at org/jruby/RubyKernel.java:1042
              (root) at script/rails:6

jruby-1.6.7 rails 3.2.3 And using suggestion https://gist.github.com/2392346 as per recommendation here https://github.com/cowboyd/less.rb/pull/26#issuecomment-5177533

kares commented 12 years ago

hey, thanks for testing this out ! seems really weird cause there definitely should be a (java) method :

>> require 'rhino'
=> true
>> require 'rhino/version'
=> true
>> Rhino::VERSION
=> "1.73.2"
>> Java::OrgMozillaJavascript::ScriptRuntime.setBuiltinProtoAndParent
ArgumentError: wrong number of arguments (0 for 3)
  from (irb):6:in `evaluate'
  from org/jruby/RubyKernel.java:1083:in `eval'
  from /opt/local/rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:158:in `eval_input'
  from /opt/local/rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:271:in `signal_status'
  from /opt/local/rvm/rubies/jruby-1.6.7/lib/ruby/1.8/irb.rb:155:in `eval_input'

does this work when you simply run irb from the same set of gems as your rails app ?

brutuscat commented 12 years ago

Yes I was thinking about this too. I'm also switching to rbenv so maybe RVM didn't uninstall properly and is picking rhino from somewhere else...

brutuscat commented 12 years ago

Very weird..

$ pry
[1] pry(main)> RUBY_VERSION
=> "1.9.2"
[2] pry(main)> require 'rhino'
=> true
[3] pry(main)> require 'rhino/version'
=> true
[4] pry(main)> Rhino::VERSION
=> "1.73.2"
[5] pry(main)> Java::OrgMozillaJavascript::ScriptRuntime.setBuiltinProtoAndParent
NoMethodError: undefined method `setBuiltinProtoAndParent' for Java::OrgMozillaJavascript::ScriptRuntime:Class
backtrace: ["(pry):5:in `re'", "org/jruby/RubyBinding.java:134:in `eval'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_instance.rb:249:in `re'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_instance.rb:216:in `rep'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_instance.rb:200:in `repl'", "org/jruby/RubyKernel.java:1410:in `loop'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_instance.rb:199:in `repl'", "org/jruby/RubyKernel.java:1197:in `catch'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_instance.rb:198:in `repl'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/pry_class.rb:136:in `start'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/cli.rb:150:in `(root)'", "org/jruby/RubyProc.java:258:in `call'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/cli.rb:59:in `parse_options'", "org/jruby/RubyArray.java:1615:in `each'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/lib/pry/cli.rb:59:in `parse_options'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/pry-0.9.8.4-java/bin/pry:16:in `(root)'", "org/jruby/RubyKernel.java:1068:in `load'", "/Users/mauroasprea/.rbenv/versions/jruby-1.6.7/bin/pry:19:in `(root)'"]
[6] pry(main)> 
kares commented 12 years ago

also creating a new rails 3.2.3 app with jruby 1.6.7 did not reproduce the issue :

kares@theborg:~/workspace/github/therubyrhino/.tmp/issue18$ rails s
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-04-18 09:51:05] INFO  WEBrick 1.3.1
[2012-04-18 09:51:05] INFO  ruby 1.8.7 (2012-02-22) [java]
[2012-04-18 09:51:10] INFO  WEBrick::HTTPServer#start: pid=6722 port=3000

here are the gems: https://gist.github.com/0aaae1906fa00f6507ba maybe you can post your Gemfile/Gemfile.lock so I can try reproducing this further ?

brutuscat commented 12 years ago

Gemfile

require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']
source 'http://rubygems.org'

# gem 'sendfile'
gem 'rack-contrib'
gem 'rails', '~> 3.2'
gem 'sqlite3'
gem 'mysql2', :platforms => :ruby
gem 'haml'
gem 'jquery-rails'
gem 'nokogiri'
gem "paperclip", :git => 'https://github.com/thoughtbot/paperclip.git'
gem "devise", ">= 1.5.0"

gem 'less', :git => 'git://github.com/kares/less.rb.git', :submodules => true
gem 'less-rails', '>= 2.2.1'

gem 'therubyracer', :platforms => :ruby
gem 'therubyrhino', :platforms => :jruby

gem 'jruby-openssl', :platforms => :jruby
gem 'activerecord-jdbcmysql-adapter', :platforms => :jruby

gem 'twitter-bootstrap-rails', :path => "~/github/twitter-bootstrap-rails" #, :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'sunspot_rails', :git => "https://github.com/brutuscat/sunspot.git", :ref => "6861c"
gem 'sunspot', :git => "https://github.com/brutuscat/sunspot.git", :ref => "6861c"
# gem 'sunspot_rails', :path => "~/github/sunspot"
gem 'sunspot_solr', :git => "https://github.com/sunspot/sunspot.git", :branch => "master"
gem "progress_bar", "~> 0.4.0"
gem 'ancestry'
gem 'simple_form', :git => 'https://github.com/plataformatec/simple_form.git'
gem 'anemone' , :git => "https://github.com/brutuscat/anemone.git", :branch => "entretenerse"
gem 'has_scope', :git => "https://github.com/plataformatec/has_scope.git", :tag => "v0.5.1"
gem 'placeholder'
gem 'parallel'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem "geocoder"
gem 'whenever', :require => false
gem 'cancan'
gem 'rails-i18n'
gem 'faker'
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'badfruit'
gem 'sinatra'
gem 'girl_friday'
gem 'sitemap_generator'
# gem "green_monkey", '0.1.2'
gem "green_monkey", git: "https://github.com/brutuscat/green_monkey.git"
gem 'chronic_duration', git: 'git://github.com/Paxa/chronic_duration.git', ref: '8c0d0e101b'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
end

group :production do
  # gem 'zbatery'
  gem 'puma'
end

group :development, :test do
  gem "rspec-rails", "~> 2.7"
  gem "vcr", :git => 'https://github.com/myronmarston/vcr.git'
  gem "factory_girl_rails", ">= 1.4.0"
  gem "factory_girl", :require => false
  gem "fakeweb"
  gem 'spork-rails'
  gem 'guard-spork'
  gem 'pry-rails'
  gem 'pry-remote'
  gem 'pry-nav'
  gem "sunspot_matchers"
end

group :development do
  gem 'rb-readline'
  gem 'rb-fsevent'
  gem 'growl'
  gem 'guard', :git => 'git://github.com/guard/guard.git'
  gem "guard-bundler", ">= 0.1.3"
  gem "guard-rails", ">= 0.0.3"
  gem "guard-rspec", ">= 0.4.3"
  gem "guard-cucumber", ">= 0.6.1"
  gem 'haml-rails'
  gem 'capistrano'
end

group :test do
  gem "capybara", ">= 1.1.2"
  gem "database_cleaner"
  gem "launchy", ">= 2.0.5"
  gem 'capybara-webkit', :git => 'https://github.com/thoughtbot/capybara-webkit.git'
  gem 'shoulda'
end

Gemfile.lock

GIT
  remote: git://github.com/Paxa/chronic_duration.git
  revision: 8c0d0e101bdbaf2b2299f33e7bfa880b0885a017
  ref: 8c0d0e101b
  specs:
    chronic_duration (0.9.6)
      numerizer (~> 0.1.1)

GIT
  remote: git://github.com/guard/guard.git
  revision: 20756e9bcfd3fdb7bcfc00ebefb6a0506200f6c3
  specs:
    guard (1.0.1)
      ffi (>= 0.5.0)
      thor (~> 0.14.6)

GIT
  remote: git://github.com/kares/less.rb.git
  revision: 9d1a24f2e73ef6b0c60a213cbb912d41dd604534
  submodules: true
  specs:
    less (2.1.0)

GIT
  remote: git://github.com/sferik/rails_admin.git
  revision: e12f8b4fd0d2198da2684ad787c488e26564eaa0
  specs:
    rails_admin (0.0.1)
      bbenezech-nested_form (~> 0.0.6)
      bootstrap-sass (~> 2.0)
      builder (~> 3.0)
      coffee-rails (~> 3.1)
      haml (~> 3.1)
      jquery-rails (>= 1.0)
      jquery-ui-rails (~> 0.2.2)
      kaminari (~> 0.12)
      rack-pjax (~> 0.5)
      rails (~> 3.1)
      remotipart (~> 1.0)
      sass-rails (~> 3.1)

GIT
  remote: https://github.com/brutuscat/anemone.git
  revision: f722e2a62e6e5d6bec634d1ab356edb6cbf95338
  branch: entretenerse
  specs:
    anemone (0.7.1)
      nokogiri (>= 1.3.0)
      robotex (>= 1.0.0)

GIT
  remote: https://github.com/brutuscat/green_monkey.git
  revision: d3e031a1a8f66991d8d9f6d0825383876dad5aad
  specs:
    green_monkey (0.1.2)
      chronic_duration
      haml (>= 3.1.0)
      mida_vocabulary (>= 0.1)

GIT
  remote: https://github.com/brutuscat/sunspot.git
  revision: 6861c61b33eee01581bc38facac7ad18043e59e3
  ref: 6861c
  specs:
    sunspot (2.0.0.pre.111215)
      escape (~> 0.0.4)
      pr_geohash (~> 1.0)
      rsolr (~> 1.0.6)
    sunspot_rails (2.0.0.pre.111215)
      nokogiri
      sunspot (= 2.0.0.pre.111215)

GIT
  remote: https://github.com/myronmarston/vcr.git
  revision: 4f900a784c23f1eaee9c146a8a65c548ef5b5acf
  specs:
    vcr (2.0.0)

GIT
  remote: https://github.com/plataformatec/has_scope.git
  revision: b9cee9e1301a7b6e16db6ec78e01dc4bfbc68faf
  tag: v0.5.1
  specs:
    has_scope (0.5.1)

GIT
  remote: https://github.com/plataformatec/simple_form.git
  revision: 63d3f84175ae2ced774a90126532bef4eed7615c
  specs:
    simple_form (2.0.2.dev)
      actionpack (~> 3.0)
      activemodel (~> 3.0)

GIT
  remote: https://github.com/sunspot/sunspot.git
  revision: 01aab29c374b70cd3c8fa413d37ec90d94b32180
  branch: master
  specs:
    sunspot_solr (2.0.0.pre.111215)

GIT
  remote: https://github.com/thoughtbot/capybara-webkit.git
  revision: 73618220b0d8840c713f40767ac19168f7a4a288
  specs:
    capybara-webkit (0.11.0)
      capybara (>= 1.0.0, < 1.2)
      json

GIT
  remote: https://github.com/thoughtbot/paperclip.git
  revision: 02d99ec3989408da7c4e98a2ea083747f9cb1b60
  specs:
    paperclip (3.0.2)
      activemodel (>= 3.0.0)
      activerecord (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (>= 0.0.2)
      mime-types

PATH
  remote: ~/github/twitter-bootstrap-rails
  specs:
    twitter-bootstrap-rails (2.0.1.0)
      actionpack (>= 3.1)
      less-rails (~> 2.2.1)
      railties (>= 3.1)

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (3.2.3)
      actionpack (= 3.2.3)
      mail (~> 2.4.4)
    actionpack (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.1)
      rack (~> 1.4.0)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.1.2)
    activemodel (3.2.3)
      activesupport (= 3.2.3)
      builder (~> 3.0.0)
    activerecord (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activerecord-jdbc-adapter (1.2.2)
    activerecord-jdbcmysql-adapter (1.2.2)
      activerecord-jdbc-adapter (~> 1.2.2)
      jdbc-mysql (~> 5.1.0)
    activeresource (3.2.3)
      activemodel (= 3.2.3)
      activesupport (= 3.2.3)
    activesupport (3.2.3)
      i18n (~> 0.6)
      multi_json (~> 1.0)
    addressable (2.2.7)
    ancestry (1.2.5)
      activerecord (>= 2.2.2)
    arel (3.0.2)
    badfruit (1.1.1)
      httparty
      json
    bbenezech-nested_form (0.0.6)
    bcrypt-ruby (3.0.1-java)
    blankslate (2.1.2.4)
    bootstrap-sass (2.0.2)
    bouncy-castle-java (1.5.0146.1)
    builder (3.0.0)
    cancan (1.6.7)
    capistrano (2.12.0)
      highline
      net-scp (>= 1.0.0)
      net-sftp (>= 2.0.0)
      net-ssh (>= 2.0.14)
      net-ssh-gateway (>= 1.1.0)
    capybara (1.1.2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 0.1.4)
    childprocess (0.3.1)
      ffi (~> 1.0.6)
    chronic (0.6.7)
    cocaine (0.2.1)
    coderay (1.0.6)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.1)
    connection_pool (0.1.0)
    cucumber (1.1.9)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.2)
      gherkin (~> 2.9.0)
      json (>= 1.4.6)
      term-ansicolor (>= 1.0.6)
    database_cleaner (0.7.2)
    devise (2.0.4)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.0.3)
      railties (~> 3.1)
      warden (~> 1.1.1)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    escape (0.0.4)
    execjs (1.3.0)
      multi_json (~> 1.0)
    factory_girl (3.1.1)
      activesupport (>= 3.0.0)
    factory_girl_rails (3.1.0)
      factory_girl (~> 3.1.0)
      railties (>= 3.0.0)
    faker (1.0.1)
      i18n (~> 0.4)
    fakeweb (1.3.0)
    fattr (2.2.1)
    ffi (1.0.11-java)
    geocoder (1.1.1)
    gherkin (2.9.3-java)
      json (>= 1.4.6)
    girl_friday (0.9.7)
      connection_pool (~> 0.1.0)
    growl (1.0.3)
    guard-bundler (0.1.3)
      bundler (>= 1.0.0)
      guard (>= 0.2.2)
    guard-cucumber (0.7.5)
      cucumber (>= 0.10)
      guard (>= 0.8.3)
    guard-rails (0.1.0)
      guard (>= 0.2.2)
    guard-rspec (0.7.0)
      guard (>= 0.10.0)
    guard-spork (0.6.1)
      guard (>= 0.10.0)
      spork (>= 0.8.4)
    haml (3.1.4)
    haml-rails (0.3.4)
      actionpack (~> 3.0)
      activesupport (~> 3.0)
      haml (~> 3.0)
      railties (~> 3.0)
    highline (1.6.11)
    hike (1.2.1)
    hpricot (0.8.6-java)
    httparty (0.8.2)
      multi_json
      multi_xml
    i18n (0.6.0)
    jdbc-mysql (5.1.13)
    journey (1.0.3)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    jquery-ui-rails (0.2.2)
      jquery-rails
      railties (>= 3.1.0)
    jruby-openssl (0.7.6.1)
      bouncy-castle-java (>= 1.5.0146.1)
    json (1.6.6-java)
    kaminari (0.13.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
      railties (>= 3.0.0)
    launchy (2.1.0-java)
      addressable (~> 2.2.6)
      ffi (~> 1.0.9)
      spoon (~> 0.0.1)
    less-rails (2.2.1)
      actionpack (>= 3.1)
      less (~> 2.1.0)
    libwebsocket (0.1.3)
      addressable
    mail (2.4.4)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.7.1)
    mida_vocabulary (0.1.3)
      blankslate
    mime-types (1.18)
    multi_json (1.3.1)
    multi_xml (0.4.4)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-sftp (2.0.5)
      net-ssh (>= 2.0.9)
    net-ssh (2.3.0)
    net-ssh-gateway (1.1.0)
      net-ssh (>= 1.99.1)
    nokogiri (1.5.2-java)
    numerizer (0.1.1)
    options (2.3.0)
      fattr
    orm_adapter (0.0.7)
    parallel (0.5.16)
    placeholder (0.0.6)
    polyglot (0.3.3)
    pr_geohash (1.0.0)
    progress_bar (0.4.0)
      highline (~> 1.6.1)
      options (~> 2.3.0)
    pry (0.9.8.4-java)
      coderay (~> 1.0.5)
      method_source (~> 0.7.1)
      slop (>= 2.4.4, < 3)
      spoon (~> 0.0)
    pry-nav (0.2.0)
      pry (~> 0.9.8.1)
    pry-rails (0.1.6)
      pry
    pry-remote (0.1.1)
      pry (~> 0.9.8)
      slop (~> 2.1)
    puma (1.2.1-java)
      rack (~> 1.2)
    rack (1.4.1)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-pjax (0.5.9)
      hpricot (~> 0.8.6)
      rack (~> 1.3)
    rack-protection (1.2.0)
      rack
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.2.3)
      actionmailer (= 3.2.3)
      actionpack (= 3.2.3)
      activerecord (= 3.2.3)
      activeresource (= 3.2.3)
      activesupport (= 3.2.3)
      bundler (~> 1.0)
      railties (= 3.2.3)
    rails-i18n (0.6.3)
      i18n (~> 0.5)
    railties (3.2.3)
      actionpack (= 3.2.3)
      activesupport (= 3.2.3)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2.2)
    rb-fsevent (0.9.1)
    rb-readline (0.4.2)
    rdoc (3.12)
      json (~> 1.4)
    remotipart (1.0.2)
    robotex (1.0.0)
    rsolr (1.0.7)
      builder (>= 2.1.2)
    rspec (2.9.0)
      rspec-core (~> 2.9.0)
      rspec-expectations (~> 2.9.0)
      rspec-mocks (~> 2.9.0)
    rspec-core (2.9.0)
    rspec-expectations (2.9.1)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.9.0)
    rspec-rails (2.9.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.9.0)
    rubyzip (0.9.7)
    sass (3.1.15)
    sass-rails (3.2.5)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    selenium-webdriver (2.21.0)
      childprocess (>= 0.2.5)
      ffi (~> 1.0)
      libwebsocket (~> 0.1.3)
      multi_json (~> 1.0)
      rubyzip
    shoulda (3.0.1)
      shoulda-context (~> 1.0.0)
      shoulda-matchers (~> 1.0.0)
    shoulda-context (1.0.0)
    shoulda-matchers (1.0.0)
    sinatra (1.3.2)
      rack (~> 1.3, >= 1.3.6)
      rack-protection (~> 1.2)
      tilt (~> 1.3, >= 1.3.3)
    sitemap_generator (3.1.1)
      builder
    slop (2.4.4)
    spoon (0.0.1)
    spork (1.0.0rc2)
    spork-rails (3.2.0)
      rails (>= 3.0.0, < 3.3.0)
      spork (>= 1.0rc0)
    sprockets (2.1.2)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sqlite3 (1.3.6)
    sunspot_matchers (1.3.0.1)
    term-ansicolor (1.0.7)
    therubyrhino (1.73.2)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.33)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    warden (1.1.1)
      rack (>= 1.0)
    whenever (0.7.3)
      activesupport (>= 2.3.4)
      chronic (~> 0.6.3)
    xpath (0.1.4)
      nokogiri (~> 1.3)

PLATFORMS
  java

DEPENDENCIES
  activerecord-jdbcmysql-adapter
  ancestry
  anemone!
  badfruit
  cancan
  capistrano
  capybara (>= 1.1.2)
  capybara-webkit!
  chronic_duration!
  coffee-rails (~> 3.2.1)
  database_cleaner
  devise (>= 1.5.0)
  factory_girl
  factory_girl_rails (>= 1.4.0)
  faker
  fakeweb
  geocoder
  girl_friday
  green_monkey!
  growl
  guard!
  guard-bundler (>= 0.1.3)
  guard-cucumber (>= 0.6.1)
  guard-rails (>= 0.0.3)
  guard-rspec (>= 0.4.3)
  guard-spork
  haml
  haml-rails
  has_scope!
  jquery-rails
  jruby-openssl
  launchy (>= 2.0.5)
  less!
  less-rails (>= 2.2.1)
  mysql2
  nokogiri
  paperclip!
  parallel
  placeholder
  progress_bar (~> 0.4.0)
  pry-nav
  pry-rails
  pry-remote
  puma
  rack-contrib
  rails (~> 3.2)
  rails-i18n
  rails_admin!
  rb-fsevent
  rb-readline
  rspec-rails (~> 2.7)
  sass-rails (~> 3.2.3)
  shoulda
  simple_form!
  sinatra
  sitemap_generator
  spork-rails
  sqlite3
  sunspot!
  sunspot_matchers
  sunspot_rails!
  sunspot_solr!
  therubyracer
  therubyrhino
  twitter-bootstrap-rails!
  uglifier (>= 1.0.3)
  vcr!
  whenever

Thanks for helping me out on this. After struggling getting to pass the initial bundle install now this I'm very unhappy!! haha

kares commented 12 years ago

I'm sorry I did not catch up your comment before requesting the Gemfiles. since you reproduced in pry it confirms it's smt about your gem setup. just to be sure I checke with --1.9 :

kares@theborg:~/workspace/github/therubyrhino/.tmp/issue18$ jruby --1.9 -S irb
>> RUBY_VERSION
=> "1.9.2"
>> require 'rhino'
=> true
>> Java::OrgMozillaJavascript::ScriptRuntime.setBuiltinProtoAndParent
ArgumentError: wrong number of arguments (0 for 3)
  from (irb):3:in `evaluate'
  from org/jruby/RubyKernel.java:1088:in `eval'
  from org/jruby/RubyKernel.java:1410:in `loop'
  from org/jruby/RubyKernel.java:1197:in `catch'
  from org/jruby/RubyKernel.java:1197:in `catch'
  from /opt/local/rvm/rubies/jruby-1.6.7/bin/jirb:17:in `(root)'

maybe you should start checking out the jar rhino loaded if it's "correct" (same size, fully extractable etc) locate it using $LOADED_FEATURES.select { |p| p =~ /rhino-1.7R3.jar/ } or try reinstalling the gem ...

brutuscat commented 12 years ago

My gosh... This will make me crazy.

Ok so I'm going to restart now and try again. After that I goging to try using rvm again and see what's going on. Also I will install the full rbenv thing in a clean machine later today and will see.

Ideas?

brutuscat commented 12 years ago

Ok so, now is even weirder... I removed rbend and reinstalled. But now I tried with jruby-1.6.6 just for fun and profit ;) (but no profit) Created a clean Gemfile like this:

source 'http://rubygems.org'

gem 'therubyrhino', :platforms => :jruby

And jruby --1.9 -S bundle install fails :S

Fetching gem metadata from http://rubygems.org/..
Installing therubyrhino (1.73.2) 

TypeError: can't dup TrueClass
An error occured while installing therubyrhino (1.73.2), and Bundler cannot continue.
Make sure that `gem install therubyrhino -v '1.73.2'` succeeds before bundling.

Ohh but jruby --1.9 -S gem install therubyrhino succeeds.

Successfully installed therubyrhino-1.73.2
1 gem installed

But the issue is very persistent in pissing me off

irb(main):003:0> Java::OrgMozillaJavascript::ScriptRuntime.setBuiltinProtoAndParent
NoMethodError: undefined method `setBuiltinProtoAndParent' for Java::OrgMozillaJavascript::ScriptRuntime:Class
    from (irb):3:in `evaluate'
    from org/jruby/RubyKernel.java:1082:in `eval'
    from org/jruby/RubyKernel.java:1408:in `loop'
    from org/jruby/RubyKernel.java:1195:in `catch'
    from org/jruby/RubyKernel.java:1195:in `catch'
    from /Users/mauroasprea/.rbenv/versions/jruby-1.6.6/bin/jirb:13:in `(root)'

So as I told I located the jar

irb(main):002:0> $LOADED_FEATURES.select { |p| p =~ /rhino-1.7R3.jar/ }
=> ["/Users/mauroasprea/.rbenv/versions/jruby-1.6.6/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/rhino-1.7R3.jar"]

and compare it with the raw jar downloaded from the repo

hamilcar:rhinotest mauroasprea$ md5 ~/Downloads/rhino-1.7R3.jar
MD5 (/Users/mauroasprea/Downloads/rhino-1.7R3.jar) = 9ca5d6cc894b8caa6ad8f908a7fd1967
hamilcar:rhinotest mauroasprea$ md5 /Users/mauroasprea/.rbenv/versions/jruby-1.6.6/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/rhino-1.7R3.jar 
MD5 (/Users/mauroasprea/.rbenv/versions/jruby-1.6.6/lib/ruby/gems/1.8/gems/therubyrhino-1.73.2/lib/rhino/rhino-1.7R3.jar) = 9ca5d6cc894b8caa6ad8f908a7fd1967

No luck for me....

brutuscat commented 12 years ago

About the size

Rhino::JS::ScriptRuntime.methods(false).size
=> 345
kares commented 12 years ago

1.6.7 should be fine, have you tried calculating the methods: Rhino::JS::ScriptRuntime.methods(false).size also you can test things out by not using the gem but the .jar directly :

kares@theborg:~/workspace/github/therubyrhino/.tmp/issue18$ jruby --1.9 -S irb
>> require 'java'
=> true
>> require "/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/therubyrhino-1.73.2/lib/rhino/rhino-1.7R3.jar"
=> true
>> Java::OrgMozillaJavascript::ScriptRuntime
=> Java::OrgMozillaJavascript::ScriptRuntime
>> Java::OrgMozillaJavascript::ScriptRuntime.methods(false).include? :setBuiltinProtoAndParent
=> true
>> Java::OrgMozillaJavascript::ScriptRuntime.methods(false).size
=> 367
>> Java::OrgMozillaJavascript::ScriptRuntime.methods(false)
=> ...

do not forget to change the .jar path based on yours ...

kares commented 12 years ago

maybe do a Java::OrgMozillaJavascript::ScriptRuntime.methods(false).grep /set/ so we see what't "left" should be:

=> [:set_name, :setObjectProp, :set_enum_numbers, :setObjectProtoAndParent, :strict_set_name, :setEnumNumbers, :setFunctionProtoAndParent, :set_default_namespace, :setDefaultNamespace, :setObjectIndex, :set_reg_exp_proxy, :set_object_prop, :set_builtin_proto_and_parent, :setObjectElem, :set_object_index, :setName, :set_function_proto_and_parent, :setBuiltinProtoAndParent, :set_object_proto_and_parent, :setRegExpProxy, :set_object_elem, :set_const, :ref_set, :setConst]

brutuscat commented 12 years ago

I tried that too. No luck. It could be a JVM issue? I don't know. If loading the jar manually didn't make it, something weird is preventing from the class to load the jar correctly. I downloaded the jar from mozilla, just for checking it and loaded it, but no luck either...

brutuscat commented 12 years ago
Java::OrgMozillaJavascript::ScriptRuntime.methods(false).grep /set/
=> [:set_name, :setObjectProp, :set_enum_numbers, :setObjectProtoAndParent, :setEnumNumbers, :setFunctionProtoAndParent, :set_default_namespace, :setDefaultNamespace, :setObjectIndex, :set_reg_exp_proxy, :set_object_prop, :setObjectElem, :set_object_index, :setName, :set_function_proto_and_parent, :set_object_proto_and_parent, :setRegExpProxy, :set_object_elem, :set_const, :ref_set, :setConst]

Also there is something worse I guess, just doing require 'java' will load the class Java::OrgMozillaJavascript::ScriptRuntime So I guess that something is loading it?

kares commented 12 years ago

not necessarily, exposing those methods correctly to the ruby side is jruby's jobs (not JVM's). any JRUBY_OPTS set, also try to post the methods you have there Java::OrgMozillaJavascript::ScriptRuntime.methods(false), than if we see what's missing maybe someone on #jruby IRC has an idea, what might be causing this ...

kares commented 12 years ago

oh in that case ignore my previous comment ... some older rhino.jar must be on the class path of your jruby ! what does $CLASSPATH give you ?

brutuscat commented 12 years ago

echo $JRUBY_OPTS --1.9

irb(main):002:0> Java::OrgMozillaJavascript::ScriptRuntime.methods(false)
=> [:typeof, :string_to_number, :notFunctionError, :search_default_namespace, :is_rhino_runtime_type, :enter_dot_query, :get_message4, :getExistingCtor, :notFoundError, :init_standard_objects, :typeError2, :addInstructionCount, :name_or_function, :eq_string, :escape_text_value, :getMessage1, :checkRegExpProxy, :indexFromString, :construct_error, :escapeString, :getGlobal, :set_name, :wrap_number, :leave_dot_query, :generated_script, :wrapBoolean, :getTopLevelProp, :enterDotQuery, :make_url_for_generated_script, :get_message3, :is_rhino_runtime_type?, :setObjectProp, :call_ref, :js_line_terminator, :last_uint32_result, :get_object_index, :default_object_to_source, :rhinoRuntimeType, :delete_object_elem?, :get_existing_ctor, :delete_object_elem, :wrapNumber, :undef_write_error, :enter_activation_function, :enum_change_object, :get_index_object, :getCallable, :toInteger, :set_enum_numbers, :errorWithClassName, :to_object, :eqNumber, :initStandardObjects, :is_special_property?, :enterActivationFunction, :eq_number, :isVisible, :new_object_literal, :newCatchScope, :initScript, :last_index_result, :evalSpecial, :getMessage, :refDel, :get_prop_function_and_this, :special_property?, :is_js_line_terminator?, :get_library_scope_or_null, :specialRef, :setObjectProtoAndParent, :wrap_int, :padArguments, :typeError0, :instance_of, :valid_identifier_name?, :doTopCall, :get_object_prop_no_warn, :storeScriptable, :enumId, :is_visible, :get_message1, :apply_or_call, :getMessage3, :new_catch_scope, :escape_string, :enum_next, :do_top_call, :is_valid_identifier_name, :is_primitive, :get_top_call_scope, :exitActivationFunction, :getMessage0, :getIndexObject, :getArrayElements, :setEnumNumbers, :cmp_LE, :newObject, :js_line_terminator?, :elem_incr_decr, :do_scriptable_incr_decr, :setFunctionProtoAndParent, :is_array_object, :toNumber, :not_found_error, :wrap_boolean, :cmp_le, :visible, :jSLineTerminator, :warn_about_non_js_object, :makeUrlForGeneratedScript, :index_from_string, :getNameFunctionAndThis, :warnAboutNonJSObject, :shallowEq, :get_message2, :topScopeName, :to_boolean, :initFunction, :rhino_runtime_type?, :undefWriteError, :getObjectPropNoWarn, :defaultObjectToString, :check_reg_exp_proxy, :eq_number?, :enum_init, :searchDefaultNamespace, :enter_with, :set_default_namespace, :enumInit, :is_array_object?, :isJSLineTerminator, :is_js_line_terminator, :doScriptableIncrDecr, :shallow_eq, :name, :newObjectLiteral, :generated_script?, :isArrayObject, :current_xml_lib, :escapeTextValue, :enumNext, :has_object_elem?, :call_special, :findFunctionActivation, :is_visible?, :setDefaultNamespace, :eqString, :find_function_activation, :store_uint32_result, :currentXMLLib, :get_elem_function_and_this, :getLibraryScopeOrNull, :get_value_function_and_this, :getObjectElem, :nameIncrDecr, :call, :eq?, :to_iterator, :js_delegates_to?, :hasTopCall, :is_special_property, :has_top_call, :primitive, :getMessage2, :java_method, :check_dynamic_scope, :isPrimitive, :nameOrFunction, :generatedScript, :getPropFunctionAndThis, :get_reg_exp_proxy, :is_valid_identifier_name?, :jsDelegatesTo, :in?, :testUint32String, :add_instruction_count, :top_scope_name, :to_object_or_null, :refIncrDecr, :lastUint32Result, :undef_call_error, :getApplyArguments, :to_uint32, :setObjectIndex, :checkDynamicScope, :store_index_result, :set_reg_exp_proxy, :java_send, :ref_incr_decr, :in, :to_string, :set_object_prop, :ref_del, :lastStoredScriptable, :updateDotQuery, :undefCallError, :deleteObjectElem, :toStringIdOrIndex, :applyOrCall, :escape_attribute_value, :toUint16, :special_property, :callSpecial, :setObjectElem, :new_special, :enumChangeObject, :test_uint32_string, :memberRef, :toIterator, :storeUint32Result, :has_top_call?, :leaveWith, :typeError, :is_generated_script?, :leaveDotQuery, :name_ref, :checkDeprecated, :typeError1, :set_object_index, :new_array_literal, :typeof_name, :setName, :init_function, :get_message, :undefReadError, :toPrimitive, :store_scriptable, :error_with_class_name, :defaultObjectToSource, :isSpecialProperty, :shallow_eq?, :set_function_proto_and_parent, :to_boolean?, :not_xml_error, :to_uint16, :toBoolean, :callRef, :isValidIdentifierName, :arrayObject, :instanceOf, :refSet, :array_object, :ref_get, :toString, :toObject, :not_function_error, :propIncrDecr, :nameRef, :primitive?, :get_object_elem, :bind, :init_script, :numberToString, :enum_value, :get_global, :cmp_le?, :get_message0, :toUint32, :update_dot_query, :createFunctionActivation, :create_function_activation, :isRhinoRuntimeType, :newArrayLiteral, :hasObjectElem, :eq_string?, :set_object_proto_and_parent, :is_generated_script, :toObjectOrNull, :visible?, :getRegExpProxy, :lastIndexResult, :get_array_elements, :check_deprecated, :eq, :cmp_LT, :getObjectProp, :has_object_elem, :escapeAttributeValue, :undef_read_error, :prop_incr_decr, :number_to_string, :validIdentifierName, :getValueFunctionAndThis, :specialProperty, :stringToNumber, :rhino_runtime_type, :typeofName, :enumValue, :special_ref, :getObjectIndex, :type_error1, :default_object_to_string, :newSpecial, :setRegExpProxy, :elemIncrDecr, :getPropFunctionAndThisHelper, :is_primitive?, :getMessage4, :eval_special, :set_object_elem, :to_integer, :set_const, :to_int32, :array_object?, :type_error3, :get_apply_arguments, :get_object_prop, :enterWith, :js_delegates_to, :storeIndexResult, :cmp_lt?, :member_ref, :type_error0, :cmp_lt, :constructError, :pad_arguments, :uneval, :add, :exit_activation_function, :type_error, :toInt32, :wrapInt, :ref_set, :type_error2, :enum_id, :get_top_level_prop, :new_object, :to_string_id_or_index, :leave_with, :to_primitive, :delete, :get_name_function_and_this, :isGeneratedScript, :notXmlError, :get_prop_function_and_this_helper, :last_stored_scriptable, :refGet, :setConst, :to_number, :getTopCallScope, :name_incr_decr, :get_callable, :valid_identifier_name, :typeError3, :getElemFunctionAndThis]
brutuscat commented 12 years ago

Runing in irb right?

=> []```
kares commented 12 years ago

I suspect it's on java's "builtin" cp in that case this should work (in irb after require 'java'), but I might be wrong : to_java.getClass.getResource('/org/mozilla/javascript/ScriptRuntime.class').toString

brutuscat commented 12 years ago

I think you were right :D

rb(main):002:0> to_java.getClass.getResource('/org/mozilla/javascript/ScriptRuntime.class').toString
=> "jar:file:/Users/mauroasprea/Library/Java/Extensions/js.jar!/org/mozilla/javascript/ScriptRuntime.class"

now how to remove this from my class path?

brutuscat commented 12 years ago

Maybe sometime I installed rhino for something I was trying.... I think a couple years ago I was building some mozilla projects that I was researching.

brutuscat commented 12 years ago

YES :D Removed that jar and now finally works!!!!! :D

Where can I buy you a beer? Let me know if you are coming to Barcelona sometime ;)

Thank you so much!!!!

kares commented 12 years ago

BINGO, you see rhino's classes from there take preference over "our" gem rhino.jar ... well you can always delete it ... honestly, I don't know as I do not use OSX and this is clearly it's "java" thingy !

kares commented 12 years ago

well that's a coincidence: I just booked a flat in Barcelona in two weeks :) but I'll be staying with my girlfriend (if it ever gets confirmed), thus maybe next time ... enjoy rhino and less.rb, let us know if there are any further issues before it gets out.

brutuscat commented 12 years ago

That's Ok ;) If you reconsider I have just emailed you. Thanks again!