No such file to load -- bundler/setup (with bundler 1.3.4) #144

BrandonMathis opened this Issue Mar 20, 2013 · 23 comments


None yet
6 participants

We've had this issue before 75 and 27. Tomcat is giving me a org.jruby.rack.RackInitializationException: no such file to load -- bundler/setup error when I try to load the app

Downgrading to bundler v 1.2.4 fixed this for me.

I thought I would post this issue with hopes someone can duplicate it and perhaps together we can ascertain a fix.


I haven't had a chance yet to delve deeply into this problem, but I was able to demonstrate that for bundler versions 1.3.0 and newer, warbler improperly packages the bundler gem. More specifically, the directory structure of the packaged bundler gem is incorrect in the war file.

As was the case for Brandon, downgrading to bundler 1.2.4 gets our app to load.

We're running jruby 1.7.3, warbler 1.3.6, jruby-rack, and rails 3.2.13.


jkutner commented Apr 6, 2013

Do you have a sample app that can reproduce this?

I believe I'm experiencing the same issue, though it's failing to load a different file. bundler/setup seems to load, but none of its included files do. (i've seen both bundler/resolver and bundler/index fail.)

I've created a sample app (with README) here: but I'm afraid I haven't had any luck tracking down the underlying cause.


jkutner commented Apr 21, 2013

I ran your sample app and could not reproduce the error. Here's what I'm using:

  • jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [darwin-x86_64]
  • Bundler 1.3.5
  • Warbler 1.3.6

Could you add your Gemfile.lock so I can see if there any other differences?

I've tried it with JRuby 1.7.2 on both Oracle Java and OpenJDK, and both result in the same error. I am running on Ubuntu 12.10, however.

  • jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_21-b11 [linux-amd64]
  • jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on OpenJDK 64-Bit Server VM 1.7.0_15-b20 [linux-amd64]

I've pushed the Gemfile.lock I'm using, as well as the generated myapp.jar. I've tried adding Bundler and specifying jruby-jars to 1.7.2, then using bundle exec warble to use 1.7.2 specifically, but that just changes the error message to a LoadError for bundler/index.

If you can run myapp.jar then I suppose it must be something different about my execution environment. Otherwise, perhaps you can spot a difference between my generated JAR and then one you generate? If you want to post the JAR you generate that works on your machine, I could create another repo of my exploded JAR and diff them.


jkutner commented Apr 21, 2013

I've pushed my jar here: But the jar in your repo works for me, as well as the one I created myself. All my gems are the same :( sorry. Here's more info on my system:

$ uname -a Darwin largo.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 $ java -version java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode) $ jruby -v jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_09-b05 [darwin-x86_64] $ bundle version Bundler version 1.3.5

@BrandonMathis or @marcusgpeterson - perhaps you could give my test repo a try and at least determine if we're having the same issue?

As expected, the jar from @jkutner fails with the same error on my machine.

I tried putting some debugging before it fails out, and with !/gems/bundler-1.3.5/lib in the load path, I see no reason why require "bundler/index" would fail, although Bundler uses autoload for the files I see it fail on.

GEM_HOME: file:/home/doug/projects/warbler144/myapp.jar!
GEM_HOME: file:/home/doug/projects/warbler144/myapp.jar!
Gem.dir: file:/home/doug/projects/warbler144/myapp.jar!
Bundler.bundle_path: file:/home/doug/projects/warbler144/myapp.jar!
Bundler.root: file:/home/doug/projects/warbler144/myapp.jar!/warbler144
Load paths:
# I even see the file in here!
Gemfile: file:/home/doug/projects/warbler144/myapp.jar!/warbler144/Gemfile

Sorry for all the posts, but I've found a workaround that allows my sample app to run: doxavore/warbler144@ddc0806

It seems all of the things that Bundler sets up as an autoload don't actually autoload in my environment. I just kept running it and requiring each load error until the app ran through.

I'm inclined to believe this may be a totally different issue than originally reported here. Unless anyone has any pointers, I'll continue to attempt to debug this on my own and ping around in #jruby

Just to close the loop on your issue, @doxavore - I'm able to run your test repo without any trouble.

I've been pretty busy of late, but hopefully I'll have a chance to reproduce my issue in a sample app soon and report my findings here.

Another data point: the problem seems to be limited to bundles that have been installed in "--deployment" mode.

I've been able to demonstrate the problem using a forked version of @doxavore's repo:

My modified README describes the steps required to reproduce.


jkutner commented Apr 23, 2013

Thanks for setting this up. I can clearly see the problem now. I've got some specs that reproduce it, but it'll take some time to figure out how to fix them.

@marcusgpeterson thanks for putting that together 👍 this helps me better understand what the error I've been wrestling with for the past few months now


jkutner commented Apr 24, 2013

is bundling with --deployment a must have? It seems odd because warbler will package the gems into the Jar anyways. I'm curious what purpose you're using it for.

Bundling with --deployment is critical to our deployment process in that it allows us to install gems to an area (namely, vendor/bundle) to which we have write access. This is important, because in certain cases, we don't have permissions to install systemwide gems on our deployment servers.

While not being able to install system gems sometimes feels like an unreasonable restriction, the --deployment option is a fantastic workaround; it allows us to circumvent the need for system gem installation entirely.

Does this make sense?

bundle with --deployment is pretty standard practice for deploying rails apps because it installs your gems to vendor/bundle. Capistrano uses this flag by default.

@jkutner jkutner added a commit that referenced this issue Apr 25, 2013

@jkutner jkutner improved test for #144 ac0a681

jkutner commented Apr 25, 2013

Can you confirm that what's in master fixes this issue? I tested on @marcusgpeterson repo and it seems to work, but I'd like to know that it works in the real world too before closing this issue.

@jkutner I've verified that your changes fix the problem in both my test repo and in my real-world web application. Thanks a ton for getting this working. Fantastic job!


jkutner commented Apr 26, 2013

I"m going to close this even though I haven't heard from @BrandonMathis. We can reopen it if there is still a problem. Thanks for the help in nailing this down!

jkutner closed this Apr 26, 2013

Yep, the issue is fixed for me on master.

I'm having this issue with 1.4.0.beta2.

Here's my repo with a sample: (see commit 26a7b65ea5f819721686429303e9ce6bba64f0b3)

I think there may be a regression on this issue.

I'm hitting the same problem "LoadError: no such file to load -- bundler/index" when trying to run a jar generated with warble. In my environment I am using Warbler (1.4.5), Bundler (1.9.2), JRuby (1.7.19) on Ubuntu (14.04.02)

After arriving at this issue (#144), I cloned the repo from @doxavore and followed the steps to reproduce the problem and arrived at the same error: LoadError: no such file to load -- bundler/index.

Also, I tried to run the jar from @jkutner and it gave me that same error.

@hakamadare hakamadare added a commit to FitnessKeeper/monkeybusiness-rb that referenced this issue Jul 8, 2015

@hakamadare hakamadare building a JAR with warbler
maybe encountering jruby/warbler#144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment