Padrino & Trinidad undefined method `register' for Rack::Handler:Module

442 views Asked by At

Trying to run a sample_blog application Padrino framework based application on Trinidad throws weird error

undefined method `register' for Rack::Handler:Module

Using: trinidad-1.3.4 jruby-rack-1.1.4

Following is the stack trace

ip-192-168-1-126: $ trinidad -p 4000
    Mar 11, 2012 6:05:24 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-4000"]
    Mar 11, 2012 6:05:24 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Tomcat
    Mar 11, 2012 6:05:24 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
    2012-03-11 23:05:24 INFO: No global web.xml found
    2012-03-11 23:05:25 INFO: jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
    2012-03-11 23:05:34 INFO: Info: received min runtimes = 1
    2012-03-11 23:05:35 INFO: Info: received max runtimes = 5
    2012-03-11 23:05:35 INFO: An exception happened during JRuby-Rack startup
    **undefined method `register' for Rack::Handler:Module**
    --- System
    **jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]**
    Time: Sun Mar 11 18:05:34 -0500 2012
    Server: Apache Tomcat/7.0.23
    jruby.home: /Users/dayas/.rbenv/versions/jruby-1.6.7

    --- Context Init Parameters:
    jruby.compat.version = 1.8.7
    jruby.initial.runtimes = 1
    jruby.max.runtimes = 5
    jruby.min.runtimes = 1
    public.root = /public
    rack.env = development
    rackup.path = config.ru

    --- Backtrace
    **NoMethodError: undefined method `register' for Rack::Handler:Module**
             (root) at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/mizuno-0.5.1/lib/mizuno/http_server.rb:179
            require at org/jruby/RubyKernel.java:1033
             (root) at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/mizuno-0.5.1/lib/mizuno/http_server.rb:26
            require at org/jruby/RubyKernel.java:1033
            require at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/mizuno-0.5.1/lib/mizuno.rb:68
               each at org/jruby/RubyArray.java:1615
            require at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.0/lib/bundler/runtime.rb:66
               each at org/jruby/RubyArray.java:1615
            require at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.0/lib/bundler/runtime.rb:55
            require at /Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/bundler-1.1.0/lib/bundler.rb:118
             (root) at /Users/dayas/RubyProjects/trying_new_padrino/sample_blog/config/boot.rb:8
            require at org/jruby/RubyKernel.java:1033
             (root) at /Users/dayas/RubyProjects/trying_new_padrino/sample_blog/config/boot.rb:7
      instance_eval at org/jruby/RubyKernel.java:2045
         initialize at file:/Users/dayas/.rbenv/versions/jruby-1.6.7/lib/ruby/gems/1.8/gems/jruby-rack-1.1.4/lib/jruby-rack-1.1.4.jar!/vendor/rack-1.4.1/rack/builder.rb:51
             (root) at /Users/dayas/RubyProjects/trying_new_padrino/sample_blog/config.ru:1
1

There are 1 answers

2
kares On

you seem to have gem 'mizuno' in your Gemfile which depends on rack and somehow clashes. we've already seen a similar issue with trinidad itself https://github.com/trinidad/trinidad/issues/29

but I do not think it's exactly the same cause, first of all I would recommend declaring your server dependencies "correctly" http://log.kares.org/2012/03/managing-server-dependencies-with.html

so your Gemfile should probably look like:

gem 'trinidad', :require => nil
gem 'mizuno', :require => nil

besides I would also recommend using bundle exec trinidad to avoid loading a "conflicting" gem before bundler kicks in ...