jruby/warbler

Could not find rake-12.3.1 in any of the sources

pytong opened this issue · 9 comments

Got "Could not find rake-12.3.1 in any of the sources" while trying to run the app using the war file.

Environment:
warbler-2.0.5
rails-4.2.9
jruby-9.1.16.0

The war file was built with this command:
warble runnable executable war

Content of warble.rb:

Warbler::Config.new do |config|
  config.dirs = %w(app config db lib tmp)
  config.includes = FileList["Rakefile", "Gemfile", "Gemfile.lock", "config.ru"]
  config.excludes = FileList["tmp/**/*", "log/**/*"]
  config.java_libs = [] if ENV["CONTAINER_JRUBY"]
  config.webinf_files += FileList["webserver.xml"]
  config.webxml.jruby.rack.logging.name = 'mobile-services'
end

Getting this error when I try to start the app:

03:55:54.681 ESC[1;31mERRORESC[0;39m [ESC[36mmobile-servicesESC[0;39m] ESC[1;30m(main)ESC[0;39m initialization failed
org.jruby.rack.RackInitializationException: Could not find rake-12.3.1 in any of the sources
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize'
        from org/jruby/RubyArray.java:2589:in `map!'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
        from /opt/tm-sorg/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<main>'
        from org/jruby/RubyKernel.java:970:in `require'

I unpacked the war file and checked the gems and rake-12.3.1 is packaged in the war file.

I saw this from the stack trace when the war file fails to run:

Gem.dir: /opt/tm-sorg
Gem.path: /opt/tm-sorg-tms/.gem/jruby/2.5.0

/opt/tm-sorg-tms/.gem/jruby/2.5.0 is not a valid path.

Could Gem.path be the cause of the problem?

I'm experiencing a similar issue:

Error: Could not find sassc-2.0.0 in any of the sources from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/spec_set.rb:87

Environment:
warbler-2.0.5
rails-5.2.1
bunder-2.0.1
jruby-9.2.5.0

The war file was built with this command:
warble war

Here is the full stack trace:
Could not find sassc-2.0.0 in any of the sources from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/spec_set.rb:87:in block in materialize' from org/jruby/RubyArray.java:2609:in map!' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/spec_set.rb:81:in materialize' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/definition.rb:170:in specs' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/definition.rb:237:in specs_for' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/definition.rb:226:in requested_specs' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/runtime.rb:108:in block in requested_specs' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/runtime.rb:20:in setup' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler.rb:107:in setup' from /usr/local/tomcat/webapps/cyber/WEB-INF/gems/gems/bundler-2.0.1/lib/bundler/setup.rb:20:in

' from org/jruby/RubyKernel.java:983:in require' from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in (root)' from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59:in <main>' from org/jruby/RubyKernel.java:983:in require' from /usr/local/tomcat/webapps/cyber/WEB-INF/config/boot.rb:3:in <main>' from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in (root)' from uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59:in require' from uri:classloader:/jruby/rack/rails/environment3.rb:23:in '

My warble.rb has config.gem_path = "WEB-INF/gems"

@mbiang any fix for this issue?

I think I'm having the same issue with sassc.

+1 same problem, blank rails app on jruby + jetty

> bundler env
...
...
Bundler       2.1.4
  Platforms   ruby, universal-java-1.8
Ruby          2.5.0p0 (2018-05-24 revision 60928) [java]
  Full Path   /usr/local/Cellar/rbenv/1.1.2/versions/jruby-9.2.0.0/bin/jruby
  Config Dir  /usr/local/Cellar/rbenv/1.1.2/versions/jruby-9.2.0.0/etc
RubyGems      2.7.6
  Gem Home    /usr/local/Cellar/rbenv/1.1.2/versions/jruby-9.2.0.0/lib/ruby/gems/shared
  Gem Path    /Users/sidu/.gem/jruby/2.5.0:/usr/local/Cellar/rbenv/1.1.2/versions/jruby-9.2.0.0/lib/ruby/gems/shared
  User Home   /Users/sidu
  User Path   /Users/sidu/.gem/jruby/2.5.0
  Bin Dir     /usr/local/Cellar/rbenv/1.1.2/versions/jruby-9.2.0.0/bin
Tools
  Git         2.26.0
  RVM         not installed
  rbenv       rbenv 1.1.2
  chruby      not installed
> bundele exec warble && java -jar wartest.war
...
...
2020-04-19 01:52:20.371:INFO::main: Logging initialized @141ms
2020-04-19 01:52:20.376:INFO:oejr.Runner:main: Runner
2020-04-19 01:52:20.457:INFO:oejs.Server:main: jetty-9.2.9.v20150224
2020-04-19 01:52:23.335:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
2020-04-19 01:52:23.532:INFO:/:main: INFO: jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.144-b01 on 1.8.0_144-b01 +jit [darwin-x86_64]
2020-04-19 01:52:23.533:INFO:/:main: INFO: using a shared (threadsafe!) runtime
uri:classloader:/jruby/rack/response.rb:294: warning: constant ::Fixnum is deprecated
uri:classloader:/jruby/rack/core_ext.rb:26: warning: constant ::NativeException is deprecated
Could not find sassc-2.3.0 in any of the sources
Run `bundle install` to install missing gems.
2020-04-19 01:52:26.422:INFO:/:main: An exception happened during JRuby-Rack startup|exit|---

Edit: To clarify, removing gem 'sass-rails', '>= 6' from the Gemfile fixes the error

In the case of sassc, that's a C extension, isn't it? https://github.com/sass/sassc-ruby - would that install even with gem install sassc for JRuby?

sassc does install a C library and then binds it with FFI. The C library would have to remain on the filesystem somewhere... I think this is a case we don't handle well in the warbler packaging, since ideally everything would go into and stay inside of the war/jar file.

We might need to look at having some way to bundle native libraries but then unpack them to a suitable temp location when the war file is running.

For users with the sassc problem, you may be able to use the pure-ruby sass gem by swapping it into your Gemfile. It's not being maintained, however, so the functionality is likely to diverge over time.

We do not have a solution for sassc + warbler yet, unfortunately.

All recent updates to this issue have been unrelated to the original report, and the original author has not returned for any updates. This may still be an issue, but I am closing the bug for now.

@pytong If you are still having problems, please reopen this bug. Recent updates to JRuby, RubyGems, and Warbler may have improved the situation, but in any case we would need to have some discussion about your environment to try to fix this. It may also be that you have an environment variable pointing at that other Gem.path location, which could certainly interfere with the warbled gem locations.

Anyone else having similar issues should open a new issue, please thank you!