Skip to content

JRuby: Rails fails to start because of Rhino::JSError: [ruby LoadError] #25

Closed
mindscratch opened this Issue Aug 21, 2012 · 7 comments

2 participants

@mindscratch

I'm using JRuby to create a new Rails 3.1.3 application which depends on the less-rails-bootstrap gem and therubyrhino (2.0.0).

I've created a view (home/index.html.erb) that just has a single <p> element and the root route points to home#index.

When I try to start Rails, I get the following (I can't copy and paste this so I'm typing some out):

Rhino::JSError: [ruby LoadError]
    call at /home/me/.rvm/gems/jruby-1.6.7@futz/gems/therubyrhino-2.0.0/lib/rhino/rhino_ext.rb:170
    call at /home/me/.rvm/gems/jruby-1.6.7@futz/gems/commonjs-0.2.6/lib/commonjs/environment.rb:18
    call at /home/me/.rvm/gems/jruby-1.6.7@futz/gems/less-2.2.1/lib/less/loader.rb:22
    call at /home/me/.rvm/gems/jruby-1.6.7@futz/gems/less-2.2.1/lib/less.rb:15
    call at /home/me/.rvm/gems/jruby-1.6.7@futz/gems/less-2.2.1/lib/less.rb:9

Output from gem env

- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.9.2 (2012-02-22 patchlevel 312) [java]
- RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6

I think that's all the relevant bits.

@kares
Collaborator
kares commented Aug 22, 2012

it seems to be missing a file to be loaded - I failed to reproduce this with a quick try.
could you please setup a minimal rails application where we can reproduce this ?

@mindscratch

I'll give it a shot this evening and post back a link to the app.

@mindscratch

I've created an application that reproduces the problem: https://github.com/mindscratch/therubyrhino-issue-25

@kares
Collaborator
kares commented Aug 23, 2012

thanks, there seems to be some kind of regression - until resolved the previous version seems to work fine, just :

gem 'therubyrhino', '1.73.5'
@kares
Collaborator
kares commented Aug 23, 2012

2.0.0 works as well but not with the latest rhino.jar :

gem 'therubyrhino', '2.0.0'
gem 'therubyrhino_jar', '1.7.3'

latest version for therubyrhino_jar is 1.7.4 where the only difference is the updated Rhino's js.jar to the latest 1.7R4 release. error appears updating gem 'therubyrhino_jar', '1.7.4' thus it's either a :

  • Rhino (Java) regression - hard to tell since there's ton of commits
  • JRuby Java integration issue - can't handle the updated Java code the same

I've built Rhino's jar from master - same error. I've also tried jruby-head (1.7) - still same error.
This is going to take some time, for the record here's the relevant Java stack trace :

#<NativeException: org.jruby.proxy.org.mozilla.javascript.JavaScriptException$Proxy2: [object LoadError]>
sun/reflect/NativeConstructorAccessorImpl.java:-2:in `newInstance0'
sun/reflect/NativeConstructorAccessorImpl.java:39:in `newInstance'
sun/reflect/DelegatingConstructorAccessorImpl.java:27:in `newInstance'
java/lang/reflect/Constructor.java:513:in `newInstance'
org/jruby/javasupport/proxy/JavaProxyConstructor.java:101:in `newInstance'
org/jruby/javasupport/proxy/JavaProxyConstructor.java:241:in `newInstance'
org/jruby/javasupport/Java.java:757:in `call'
org/jruby/internal/runtime/methods/JavaMethod.java:630:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:322:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:178:in `callBlock'
org/jruby/runtime/callsite/CachingCallSite.java:182:in `call'
org/jruby/java/proxies/ConcreteJavaProxy.java:47:in `call'
org/jruby/runtime/callsite/SuperCallSite.java:366:in `cacheAndCall'
org/jruby/runtime/callsite/SuperCallSite.java:192:in `callBlock'
org/jruby/runtime/callsite/SuperCallSite.java:197:in `call'
org/jruby/runtime/callsite/SuperCallSite.java:108:in `callVarargs'
org/jruby/ast/SuperNode.java:114:in `interpret'
org/jruby/ast/NewlineNode.java:104:in `interpret'
org/jruby/evaluator/ASTInterpreter.java:74:in `INTERPRET_METHOD'
org/jruby/internal/runtime/methods/InterpretedMethod.java:212:in `call'
org/jruby/internal/runtime/methods/DefaultMethod.java:207:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:322:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:178:in `callBlock'
org/jruby/runtime/callsite/CachingCallSite.java:182:in `call'
org/jruby/RubyClass.java:829:in `newInstance'
org/jruby/RubyClass$i$newInstance.gen:65535:in `call'
org/jruby/internal/runtime/methods/JavaMethod.java:266:in `call'
org/jruby/java/proxies/ConcreteJavaProxy.java:143:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:312:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:169:in `call'
org/jruby/ast/CallOneArgNode.java:57:in `interpret'
org/jruby/ast/NewlineNode.java:104:in `interpret'
org/jruby/evaluator/ASTInterpreter.java:74:in `INTERPRET_METHOD'
org/jruby/internal/runtime/methods/InterpretedMethod.java:190:in `call'
org/jruby/internal/runtime/methods/DefaultMethod.java:199:in `call'
org/jruby/runtime/callsite/CachingCallSite.java:312:in `cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:169:in `call'
org/jruby/ast/CallOneArgNode.java:57:in `interpret'
org/jruby/ast/FCallOneArgNode.java:36:in `interpret'
org/jruby/ast/NewlineNode.java:104:in `interpret'
org/jruby/ast/BlockNode.java:71:in `interpret'
org/jruby/ast/RescueBodyNode.java:108:in `interpret'
org/jruby/ast/RescueNode.java:181:in `handleException'
org/jruby/ast/RescueNode.java:124:in `interpretWithJavaExceptions'
org/jruby/ast/RescueNode.java:110:in `interpret'
org/jruby/ast/BeginNode.java:83:in `interpret'
org/jruby/ast/NewlineNode.java:104:in `interpret'
org/jruby/ast/BlockNode.java:71:in `interpret'
org/jruby/evaluator/ASTInterpreter.java:74:in `INTERPRET_METHOD'
org/jruby/internal/runtime/methods/InterpretedMethod.java:120:in `call'
org/jruby/internal/runtime/methods/InterpretedMethod.java:134:in `call'
org/jruby/internal/runtime/methods/DefaultMethod.java:174:in `call'
org/jruby/javasupport/proxy/JavaProxyConstructor.java:225:in `invoke'
org.jruby.proxy.org.mozilla.javascript.BaseFunction$Proxy1:-1:in `call'
org/mozilla/javascript/Interpreter.java:1473:in `interpretLoop'
org/mozilla/javascript/Interpreter.java:815:in `interpret'
org/mozilla/javascript/InterpretedFunction.java:109:in `call'
org/mozilla/javascript/NativeArray.java:1589:in `iterativeMethod'
org/mozilla/javascript/NativeArray.java:318:in `execIdCall'
org/mozilla/javascript/IdFunctionObject.java:97:in `call'
org/mozilla/javascript/Interpreter.java:1473:in `interpretLoop'
org/mozilla/javascript/Interpreter.java:815:in `interpret'
org/mozilla/javascript/InterpretedFunction.java:109:in `call'
org/mozilla/javascript/ContextFactory.java:394:in `doTopCall'
org/mozilla/javascript/ScriptRuntime.java:3091:in `doTopCall'
org/mozilla/javascript/InterpretedFunction.java:107:in `call'
sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
java/lang/reflect/Method.java:597:in `invoke'
org/jruby/javasupport/JavaMethod.java:491:in `invokeDirectWithExceptionHandling'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/therubyrhino-2.0.0/lib/rhino/rhino_ext.rb:168:in `call'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/commonjs-0.2.6/lib/commonjs/environment.rb:18:in `require'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/less-2.2.1/lib/less/loader.rb:22:in `require'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/less-2.2.1/lib/less.rb:15:in `Less'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/less-2.2.1/lib/less.rb:9:in `(root)'
org/jruby/RubyKernel.java:1042:in `require'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/less-2.2.1/lib/less.rb:68:in `require'
org/jruby/RubyArray.java:1615:in `each'
/opt/local/rvm/gems/jruby-1.6.7@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `require'
org/jruby/RubyArray.java:1615:in `each'
/opt/local/rvm/gems/jruby-1.6.7@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
/opt/local/rvm/gems/jruby-1.6.7@global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
/home/kares/workspace/github/therubyrhino/._issue-25/config/application.rb:11:in `(root)'
org/jruby/RubyKernel.java:1042:in `require'
/home/kares/workspace/github/therubyrhino/._issue-25/config/application.rb:53:in `(root)'
org/jruby/RubyKernel.java:1787:in `tap'
/opt/local/rvm/gems/jruby-1.6.7@therubyrhino/gems/railties-3.2.8/lib/rails/commands.rb:50:in `(root)'
org/jruby/RubyKernel.java:1042:in `require'
script/rails:6:in `(root)'

@kares kares added a commit to kares/therubyrhino that referenced this issue Aug 24, 2012
@kares kares 1.7R4 added a ConsString for `'s1' + 's2'` optimalization
this is the cause of the reported regression (closes #25)
6c84e6b
@kares
Collaborator
kares commented Aug 24, 2012

released 2.0.1 with this regression being fixed - should work with the latest therubyrhino_jar as well. thanks !

@kares kares closed this Aug 24, 2012
@mindscratch

@kares awesome, thanks for the quick turn around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.