JRuby on Rails app on and JBoss 4.2.0/Tomcat 5.5

2019-08-24 05:52发布

问题:

My JRuby on rails app works fine on Tomcat 6.0, But when I deploy it on my company's webfarm which is JBoss 4.2.0/Tomcat 5.5 (Servlet API 2.4) It fails with the following stack trace:

java.lang.ArrayIndexOutOfBoundsException: 0
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateBufferInvocation(AsmLibraryLoader.java:548)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateMethod(AsmLibraryLoader.java:511)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:223)
at com.kenai.jaffl.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:125)
at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:31)
at com.kenai.jaffl.provider.jffi.Provider.loadLibrary(Provider.java:25)
at com.kenai.jaffl.Library.loadLibrary(Library.java:76)
at com.kenai.jaffl.Library.loadLibrary(Library.java:48)
at org.jruby.ext.socket.RubyUNIXSocket.tryUnixDomainSocket(RubyUNIXSocket.java:167)
at org.jruby.ext.socket.RubySocket$Service.load(RubySocket.java:103)
at org.jruby.runtime.load.LoadService.reflectedLoad(LoadService.java:384)
at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:49)
at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:671)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:314)
at org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:289)
at org.jruby.RubyKernel.requireCommon(RubyKernel.java:984)
at org.jruby.RubyKernel.require(RubyKernel.java:967)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen:65535)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.rescue_1$RUBY$__rescue___0(custom_require.rb:31)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.__file__(Lruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5;Lorg.jruby.runtime.ThreadContext;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.Block;)Lorg.jruby.runtime.builtin.IRubyObject;(custom_require.rb:???)
at ruby.jit.require_120F9897B5F59B6B5FA66BC56E0277183EA7EAA5.__file__(Lorg.jruby.runtime.ThreadContext;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.builtin.IRubyObject;Lorg.jruby.runtime.Block;)Lorg.jruby.runtime.builtin.IRubyObject;(custom_require.rb:???)
at org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:153)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)

and then:

org.jruby.rack.RackInitializationException: stack level too deep
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/version.rb:298:in `<=>'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:17
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `call'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfied_by?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `all?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:129:in `satisfied_by?'
from file:/home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/lib/jruby-stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:202:in `=~'
from /home/tkjbgrpd/jboss/eap4.2/tmp/deploy/tmp23048subwire-exp.war/WEB-INF/gems/gems/bundler-1.0.2/lib/bundler/index.rb:41:in `search_for_all_platforms'
 ... 321 levels...

Thanks, Arkadiy

回答1:

First note that JRuby-Rack changed to servlet 2.5 as of the 0.9.7 release. So in order to run on 5.5 you'll have to downgrade to 0.9.6 or earlier. This may be a bit tricky with Warbler dependencies but you can manually adjust the jars in a Warbler config file using config.java_libs.

As for the errors above, I haven't seen them before. The only thing that comes to mind is that native/ffi support doesn't work in some containers and you may need to disable it with -Djruby.native.enabled=false.



回答2:

org.jruby.rack.RackInitializationException: stack level too deep

Is probably cause by a low thread stack size. Try increasing it by passing -Xss16k to the JVM. Increase it until you find a value that it's ok to your application.