Skip to content

Git-based gem dependencies break with Warbler on JRuby 9.4.13.0 #561

@tillsc

Description

@tillsc

Environment:

  • JRuby: 9.4.13.0
  • Rails: 7.1.x
  • Warbler: latest from GitHub (used via GitHub reference in gemspec)
  • Tomcat: 9 (on macOS, via Homebrew)

Description:
If the Gemfile contains any git-based gem dependency (e.g. gem 'foo', git: 'https://github.com/...), the generated WAR file fails to boot. The error occurs during Bundler setup at runtime inside the servlet container.

Expected behavior:
Applications with Git-based dependencies in the Gemfile should boot correctly when deployed as WAR.

Actual behavior:
Application fails during initialization with a Bundler error.

Stacktrace:

org.jruby.rack.RackInitializationException: undefined method `[]' for nil:NilClass
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:95:in `version'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:452:in `supports_fetching_unreachable_refs?'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:215:in `depth'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:440:in `full_clone?'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:428:in `depth_args'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:412:in `extra_clone_args'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:175:in `clone_needs_extra_fetch?'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:107:in `checkout'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:354:in `with_path'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:82:in `current_branch'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:257:in `current_branch'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:94:in `to_s'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:233:in `load_spec_files'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/path.rb:97:in `local_specs'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:198:in `specs'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/lazy_specification.rb:145:in `materialize_for_installation'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/lazy_specification.rb:134:in `materialized_for_installation'
	from org/jruby/RubyArray.java:2009:in `each'
	from org/jruby/RubyEnumerable.java:860:in `filter_map'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/gem_helpers.rb:73:in `select_best_local_platform_match'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/materialization.rb:27:in `specs'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/materialization.rb:18:in `complete?'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:236:in `block in materialize_dependencies'
	from org/jruby/RubyKernel.java:1725:in `loop'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:222:in `materialize_dependencies'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:110:in `materialize'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:640:in `materialize'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:232:in `specs'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:299:in `specs_for'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/runtime.rb:18:in `setup'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler.rb:167:in `setup'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/setup.rb:16:in `block in <main>'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/ui/shell.rb:173:in `with_level'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/ui/shell.rb:119:in `silence'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/setup.rb:16:in `<main>'
	from org/jruby/RubyKernel.java:1187:in `require'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:136:in `require'
	from /opt/homebrew/Cellar/tomcat@9/9.0.107/libexec/webapps/myapp/WEB-INF/config/boot.rb:3:in `<main>'
	from org/jruby/RubyKernel.java:1187:in `require'
	from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:136:in `require'
	from uri:classloader:/jruby/rack/rails/environment3.rb:23:in `load_environment'
	from uri:classloader:/jruby/rack/rails_booter.rb:83:in `load_environment'
	from <script>:1:in `<main>'

	at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:30)
	at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:107)
	at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4059)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4501)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:603)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1013)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1861)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:76)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:124)
	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:817)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1628)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:973)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1172)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1176)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1154)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:369)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:310)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
	at java.base/java.lang.Thread.run(Thread.java:1447)
Caused by: org.jruby.exceptions.NoMethodError: (NoMethodError) undefined method `[]' for nil:NilClass
	at RUBY.version(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:95)
	at RUBY.supports_fetching_unreachable_refs?(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:452)
	at RUBY.depth(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:215)
	at RUBY.full_clone?(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:440)
	at RUBY.depth_args(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:428)
	at RUBY.extra_clone_args(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:412)
	at RUBY.clone_needs_extra_fetch?(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:175)
	at RUBY.checkout(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:107)
	at RUBY.with_path(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:354)
	at RUBY.current_branch(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git/git_proxy.rb:82)
	at RUBY.current_branch(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:257)
	at RUBY.to_s(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:94)
	at RUBY.load_spec_files(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:233)
	at RUBY.local_specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/path.rb:97)
	at RUBY.specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/source/git.rb:198)
	at RUBY.materialize_for_installation(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/lazy_specification.rb:145)
	at RUBY.materialized_for_installation(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/lazy_specification.rb:134)
	at org.jruby.RubyArray.each(org/jruby/RubyArray.java:2009)
	at org.jruby.RubyEnumerable.filter_map(org/jruby/RubyEnumerable.java:860)
	at RUBY.select_best_local_platform_match(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/gem_helpers.rb:73)
	at RUBY.specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/materialization.rb:27)
	at RUBY.complete?(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/materialization.rb:18)
	at RUBY.materialize_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:236)
	at org.jruby.RubyKernel.loop(org/jruby/RubyKernel.java:1725)
	at RUBY.materialize_dependencies(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:222)
	at RUBY.materialize(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/spec_set.rb:110)
	at RUBY.materialize(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:640)
	at RUBY.specs(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:232)
	at RUBY.specs_for(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/definition.rb:299)
	at RUBY.setup(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/runtime.rb:18)
	at RUBY.setup(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler.rb:167)
	at RUBY.<main>(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/setup.rb:16)
	at RUBY.with_level(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/ui/shell.rb:173)
	at RUBY.silence(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/ui/shell.rb:119)
	at RUBY.<main>(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/setup.rb:16)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1187)
	at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:136)
	at RUBY.<main>(/opt/homebrew/Cellar/tomcat@9/9.0.107/libexec/webapps/myapp/WEB-INF/config/boot.rb:3)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1187)
	at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:136)
	at RUBY.load_environment(uri:classloader:/jruby/rack/rails/environment3.rb:23)
	at RUBY.load_environment(uri:classloader:/jruby/rack/rails_booter.rb:83)
	at RUBY.<main>(<script>:1)

Workaround:
Avoid Git-based dependencies in the Gemfile when using Warbler.

Repro steps:

  1. Use any Rails 7.1 app with JRuby 9.4.13.0
  2. Add a gem via git: to the Gemfile
  3. Package with warbler
  4. Deploy to Tomcat
  5. Observe failure during startup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions