Skip to content

Instantly share code, notes, and snippets.

@rafaeldff
Last active December 20, 2015 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeldff/755602803aca1ed3e593 to your computer and use it in GitHub Desktop.
Save rafaeldff/755602803aca1ed3e593 to your computer and use it in GitHub Desktop.
Exception when bootstrapping jetty with jruby.
require 'java'
Dir.glob("deps/*.jar").each {|jarfile| require jarfile}
java_import org.eclipse.jetty.server.Connector
java_import org.eclipse.jetty.server.Server
java_import org.eclipse.jetty.server.nio.SelectChannelConnector
java_import org.eclipse.jetty.webapp.WebAppContext
java_import java.io.File
java_import java.io.FileOutputStream
java_import java.io.InputStream
webapp = WebAppContext.new
webapp = WebAppContext.new;
webapp.setContextPath("/");
webapp.setWar('thefile.war');
server = Server.new;
connector = SelectChannelConnector.new;
connector.setPort(8585);
server.setConnectors([connector].to_java(Connector))
server.setHandler(webapp);
server.start();
server.join();
2013-08-08 18:15:28.858:INFO:/:An exception happened during JRuby-Rack startup|load error: jruby/rack/rack_ext -- java.lang.invoke.WrongMethodTypeException: MethodHandle(ThreadContext)IRubyObject should be of type (ThreadContext)IRubyObject|--- System|jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_40-b31 +indy [linux-amd64]|Time: 2013-08-08 18:15:28 -0300|Server: jetty/8.y.z-SNAPSHOT|jruby.home: file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home||--- Context Init Parameters:|public.root = /|rack.env = production||--- Backtrace|LoadError: load error: jruby/rack/rack_ext -- java.lang.invoke.WrongMethodTypeException: MethodHandle(ThreadContext)IRubyObject should be of type (ThreadContext)IRubyObject| require at org/jruby/RubyKernel.java:1054| require at jar:file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36| (root) at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack.rb:86| instance_eval at org/jruby/RubyBasicObject.java:1735| run_boot_hook at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:35| run_boot_hooks! at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:46| each at org/jruby/RubyArray.java:1617| run_boot_hooks! at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:44| run_boot_hooks at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:214| boot! at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:107| (root) at file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/boot/rack.rb:10| load at org/jruby/RubyKernel.java:1073| (root) at <script>:1| (root) at lib/boot.rb:7||--- RubyGems|Gem.dir: /home/rafael/.rvm/gems/jruby-1.7.4|Gem.path:|/home/rafael/.rvm/gems/jruby-1.7.4|/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/gems|/home/rafael/.rvm/gems/jruby-1.7.4@global|Activated gems:||--- Bundler|undefined method `bundle_path' for Bundler:Module||--- JRuby-Rack Config|compat_version = |default_logger = org.jruby.rack.logging.StandardOutLogger@113d8793|equals = <error: >|err = java.io.PrintStream@b5a9289|filter_adds_html = true|filter_verifies_resource = false|ignore_environment = false|initial_memory_buffer_size = |initial_runtimes = |jms_connection_factory = |jms_jndi_properties = |logger = org.jruby.rack.logging.ServletContextLogger@45cc9007|logger_class_name = servlet_context|logger_name = jruby.rack|maximum_memory_buffer_size = |maximum_runtimes = |num_initializer_threads = |out = java.io.PrintStream@64e95eab|rackup = |rackup_path = |rewindable = true|runtime_arguments = |runtime_environment = |runtime_timeout_seconds = |serial_initialization = false|servlet_context = ServletContext@o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/},services/eo2_frontend.war|throw_init_exception = false||--- $LOAD_PATH:|file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby|file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared|file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9|
2013-08-08 18:15:28.865:WARN:/:ERROR: initialization failed
org.jruby.rack.RackInitializationException: load error: jruby/rack/rack_ext -- java.lang.invoke.WrongMethodTypeException: MethodHandle(ThreadContext)IRubyObject should be of type (ThreadContext)IRubyObject|?from org/jruby/RubyKernel.java:1054:in `require'|?from jar:file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack.rb:86:in `(root)'|?from org/jruby/RubyBasicObject.java:1735:in `instance_eval'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:35:in `run_boot_hook'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:46:in `run_boot_hooks!'|?from org/jruby/RubyArray.java:1617:in `each'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:44:in `run_boot_hooks!'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:214:in `run_boot_hooks'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:107:in `boot!'|?from file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/boot/rack.rb:10:in `(root)'|?from org/jruby/RubyKernel.java:1073:in `load'|?from <script>:1:in `(root)'|?from lib/boot.rb:7:in `(root)'|
at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98)
at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:764)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:406)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:756)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:242)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at JettyWarMain.main(JettyWarMain.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:455)
at org.jruby.javasupport.JavaMethod.invokeStaticDirect(JavaMethod.java:367)
at org.jruby.java.invokers.StaticMethodInvoker.call(StaticMethodInvoker.java:60)
at org.jruby.runtime.invokedynamic.InvocationLinker.fail(InvocationLinker.java:945)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:599)
at org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(InvocationLinker.java:153)
at lib.boot.__file__(lib/boot.rb:7)
at lib.boot.load(lib/boot.rb)
at org.jruby.Ruby.runScript(Ruby.java:807)
at org.jruby.Ruby.runScript(Ruby.java:800)
at org.jruby.Ruby.runNormally(Ruby.java:669)
at org.jruby.Ruby.runFromMain(Ruby.java:518)
at org.jruby.Main.doRunFromMain(Main.java:390)
at org.jruby.Main.internalRun(Main.java:279)
at org.jruby.Main.run(Main.java:221)
at org.jruby.Main.main(Main.java:201)
Caused by:
org.jruby.exceptions.RaiseException: (LoadError) load error: jruby/rack/rack_ext -- java.lang.invoke.WrongMethodTypeException: MethodHandle(ThreadContext)IRubyObject should be of type (ThreadContext)IRubyObject
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1054)
at RUBY.require(jar:file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at RUBY.(root)(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack.rb:86)
at org.jruby.RubyBasicObject.instance_eval(org/jruby/RubyBasicObject.java:1735)
at RUBY.run_boot_hook(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:35)
at RUBY.run_boot_hooks!(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:46)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1617)
at RUBY.run_boot_hooks!(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:44)
at RUBY.run_boot_hooks(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:214)
at RUBY.boot!(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/booter.rb:107)
at RUBY.(root)(file:/tmp/jetty-0.0.0.0-8080-eo2_frontend.war-_-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/boot/rack.rb:10)
at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1073)
at RUBY.(root)(<script>:1)
at lib.boot.(root)(lib/boot.rb:7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment