How can I remove bundler from my rails 3 app?

I'm using jruby 1.6.0 and trying to deploy my rails 3 app to Tomcat.
When the app loads I get the error "stack level too deep" as bundler
is trying to resolve dependencies. I've spent hours searching forums
in an effort to resolve this but there doesn't seem to be a resolution
to this problem. Can someone explain how I can remove bundler from my
application so as I can get this deployed? It seems that bundler is
tightly integrated with Rails 3. Hopefully Rails is not dependent on
it since it makes it impossible to deploy to either Tomcat or the
Glassfish server.

Not sure about untangling rails 3 from bundler but I did find
which claims that this is a tomcat problem


No, Bundler is not really coupled. Just delete de Gemfile and you're done.

Having said that, I'd try to reach the bundler guys with a minimal app the shows your issue.

I've tried running this on Glassfish and got the exact same error, so
it must be in the bundler code. I've removed bundler from the app and
added the requires to the environment.rb file and did get this
running. However, it's obviously not an ideal solution.

boot.rb starts this way:

    require 'rubygems'
    gemfile = File.expand_path('../../../../Gemfile', __FILE__)

    if File.exist?(gemfile)
      ENV['BUNDLE_GEMFILE'] = gemfile
      require 'bundler'

That's done on purpose, so that it is trivial to out-opt. Removing the
Gemfile should be enough, if there's no Gemfile, no bundler code
should be called (and if it does, it is a bug).

Thanks Xaviar. This is very useful since I want to run bundler when I
push the code over so as I get the gems installed, but then exclude it
in the war file to run under Tomcat.