davej
davej

Reputation: 1380

changing to jruby, get RuntimeError: Server handler (thin) not found

My app works fine in MRI 1.9.2-p290 and 1.9.3-p125, but when I change to jruby-1.7.0-preview1 I get the error discribed. Here's the full error:

RuntimeError: Server handler (thin) not found.
  detect_rack_handler at /home/qry_dev/.rvm/gems/jruby-1.7.0.preview1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1402
             run! at /home/qry_dev/.rvm/gems/jruby-1.7.0.preview1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1293
           (root) at /home/qry_dev/Ruby/query_engine/query_webserver.rb:320
             load at org/jruby/RubyKernel.java:1017
           (root) at -e:1

(I tried jruby-1.6.6 already, same error.) The sinatra and thin gems (among others) are already installed. In fact, other than jruby instead of mri, everything's the same.

Any ideas? I've searched the web and seen this error, but it's usually for 3rd party tools, and nothing seems to apply.

EDIT: also tried installing thin (which I never had to do before) to linux itself via

sudo apt-get install thin

but still getting same error.

Upvotes: 1

Views: 2155

Answers (2)

Sanket Dalvi
Sanket Dalvi

Reputation: 96

You can install thin server which sinatra will pickup automatically. To install thin you can execute the following command

gem install thin

Upvotes: 0

kares
kares

Reputation: 7166

sinatra 1.3.2 (by default) checks only for mostly MRI compatible servers, see: https://github.com/sinatra/sinatra/blob/e111243e813ede1f0f4c6918d9a8cc029e776fc3/lib/sinatra/base.rb#L1514

thin, mongrel do not work on JRuby due native C code (although there's effort to make them use some "native" Java code on JRuby)

you have two options either adjust the set server while on JRuby e.g. something like:

set :server, %w[trinidad webrick] if defined?(JRUBY_VERSION)

or rackup your application with the given handler rackup -s trinidad

do not forget to gem install trinidad first (under JRuby)

Upvotes: 2

Related Questions