warbler icon indicating copy to clipboard operation
warbler copied to clipboard

nested gems in Gemfile from git repository are not warbled correctly

Open samuelkadolph opened this issue 14 years ago • 7 comments

I have

gem "activerecord-jdbcmysql-adapter", :git => "https://github.com/nicksieger/activerecord-jdbc-adapter"

in my Gemfile and when I warble my application it does not work because bundler throws an error.

https://github.com/nicksieger/activerecord-jdbc-adapter (at master) is not checked out. Please run `bundle install`
[webapp 2011/08/24 21:51:57] - Warning: no min runtimes specified.
[webapp 2011/08/24 21:51:57] - Warning: no max runtimes specified.
[webapp 2011/08/24 21:51:57] - An exception happened during JRuby-Rack startup
exit
--- System
jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
Time: 2011-08-24 21:51:57 -0400
Server: Winstone Servlet Engine v0.9.10
jruby.home: file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-stdlib-1.6.4.jar!/META-INF/jruby.home

--- Context Init Parameters:
jruby.compat.version = 1.9
public.root = /
rails.env = production

--- Backtrace
SystemExit: exit
              exit at org/jruby/RubyKernel.java:867
              exit at org/jruby/RubyKernel.java:836
            (root) at /Users/samuelkadolph/foo/WEB-INF/gems/gems/bundler-1.0.18/lib/bundler/setup.rb:14
           require at org/jruby/RubyKernel.java:1047
           require at /Users/samuelkadolph/foo/WEB-INF/gems/gems/bundler-1.0.18/lib/bundler/setup.rb:32
            (root) at /Users/samuelkadolph/foo/WEB-INF/config/boot.rb:6
           require at org/jruby/RubyKernel.java:1047
           require at /Users/samuelkadolph/foo/WEB-INF/config/boot.rb:29
  load_environment at file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:165
            to_app at file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173
               new at file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193
            (root) at <web.xml>:1
     instance_eval at org/jruby/RubyBasicObject.java:1717
        initialize at file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46
            (root) at <web.xml>:1

--- RubyGems
Gem.dir: /Users/samuelkadolph/.rvm/gems/ruby-1.9.2-p290
Gem.path:
/Users/samuelkadolph/foo/WEB-INF/gems
/Users/samuelkadolph/.rvm/gems/ruby-1.9.2-p290
/Users/samuelkadolph/.rvm/gems/ruby-1.9.2-p290@global
Activated gems:
  bundler-1.0.18

--- Bundler
Bundler.bundle_path: /Users/samuelkadolph/.rvm/gems/ruby-1.9.2-p290
Bundler.root: /Users/samuelkadolph/foo/WEB-INF
Gemfile: Gemfile
Settings:
  without = development:test:assets
  gemfile = Gemfile

--- JRuby-Rack Config
background_spooling = false
compat_version = RUBY1_9
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_runtimes = 
jms_connection_factory = 
jms_jndi_properties = 
logger = org.jruby.rack.logging.ServletContextLogger@230cc23b
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_runtimes = 
memory_buffer_size = 65536
num_initializer_threads = 
rackup = 
rackup_path = 
rewindable = true
runtime_timeout_seconds = 
serial_initialization = false
servlet_context = winstone.WebAppConfiguration@3162a60a

[webapp 2011/08/24 21:51:57] - Application Error
org.jruby.rack.RackInitializationException: exit
    from org/jruby/RubyKernel.java:836:in `exit'
    from /Users/samuelkadolph/foo/WEB-INF/gems/gems/bundler-1.0.18/lib/bundler/setup.rb:14:in `(root)'
    from org/jruby/RubyKernel.java:1047:in `require'
    from /Users/samuelkadolph/foo/WEB-INF/gems/gems/bundler-1.0.18/lib/bundler/setup.rb:32:in `require'
    from /Users/samuelkadolph/foo/WEB-INF/config/boot.rb:6:in `(root)'
    from org/jruby/RubyKernel.java:1047:in `require'
    from /Users/samuelkadolph/foo/WEB-INF/config/boot.rb:29:in `require'
    from file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:165:in `load_environment'
    from file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173:in `to_app'
    from file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193:in `new'
    from <web.xml>:1:in `(root)'
    from org/jruby/RubyBasicObject.java:1717:in `instance_eval'
    from file:/Users/samuelkadolph/foo/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46:in `initialize'
    from <web.xml>:1:in `(root)'

    at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:204)
    at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:54)
    at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95)
    at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28)
    at org.jruby.rack.RackFilter.doFilter(RackFilter.java:58)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
    at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
    at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
    at java.lang.Thread.run(Thread.java:680)
Caused by: org.jruby.exceptions.RaiseException: (SystemExit) exit

Output of ls WEB-INF/gems/bundler/gems/

activerecord-jdbc-adapter-84bee952aa80  activerecord-jdbcmysql-adapter      jdbc-mysql


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

samuelkadolph avatar Aug 25 '11 01:08 samuelkadolph

I'm getting the same error (thought with a different git gem).

levand avatar Sep 09 '11 15:09 levand

I should add, this is running the current master - I know issue #42 involved a similar issue, but that's supposedly fixed now.

levand avatar Sep 09 '11 17:09 levand

I found the problem (mine, at least). It's caused by an interaction with RVM on the same machine.

In the META-INF/init.rb, the ENV['GEM_PATH'] is not forcibly overrode, but only conditionally updated to use the war's gems using ||=. So if you already have a GEM_PATH environment variable pointing somewhere with different gems, it will fail. If whatever GEM_PATH you're using has similar gems, you'll get very subtle errors because it will be using slightly wrong versions of everything.

The fix is simply to run 'rvm reset' in the shell before you start your app server (or make sure it's not installed at all, on a production machine).

levand avatar Sep 09 '11 20:09 levand

We are seeing the same issue and rvm reset did not help. Seems like bundler no longer looks for git installed gems in bundler/gems. Modified traits/bundler.rb to remove /bundler from pathmap and our server starts correctly. Will fork, add test case and send pull request.

rohitn avatar Feb 02 '12 21:02 rohitn

Im having the same issue and rvm reset doesn't help

maxstudener avatar Mar 13 '12 22:03 maxstudener

Turns out my issue was i needed to run bundle exec warble war inside my cap file

maxstudener avatar Mar 14 '12 02:03 maxstudener

I'm seeing the same using warbler 1.3.6. Basically the gems.jar does not contain any of the gems which are specified in the Gemfile with :git =>

My warble.rb looks like:

Warbler::Config.new do |config|
  config.features = %w(gemjar executable compiled)
  config.dirs = %w(config lib tmp)
  config.webserver = 'jetty'
  config.webxml.jruby.compat.version = "1.9"
  config.includes = FileList["config.ru"] 
  config.java_libs += FileList["lib/java/*.jar"]
end

when I start my war file with "java -jar ..." what I see in the console is:

2012-09-03 10:45:13.330:INFO:/:An exception happened during JRuby-Rack startup|git://github.com/digitalplaywright/mongoid-slug.git (at master) is not checked out. Please run `bundle install`|--- System

bsbodden avatar Sep 03 '12 18:09 bsbodden