mkristian / jar-dependencies

manage jar dependencies for ruby gems
MIT License
34 stars 19 forks source link

Example Walkthrough Fails #68

Open klobuczek opened 5 years ago

klobuczek commented 5 years ago

The 3rd step in the example walkthrough fails:

heinrich@berlin:~/mck/examples/jar-dependencies/example$ rake --trace
rake aborted!
NameError: cannot load (ext) (org.jruby.ext.openssl.OpenSSL)
org/jruby/ext/jruby/JRubyUtilLibrary.java:184:in `load_ext'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31:in `<main>'
org/jruby/RubyKernel.java:983:in `require'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/openssl.rb:1:in `<main>'
org/jruby/RubyKernel.java:983:in `require'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/openssl.rb:1:in `<main>'
org/jruby/RubyKernel.java:983:in `require'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/security.rb:1:in `<main>'
org/jruby/RubyKernel.java:983:in `require'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/security.rb:12:in `<main>'
org/jruby/RubyKernel.java:983:in `require'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/package.rb:1:in `<main>'
org/jruby/RubyKernel.java:1007:in `load'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/package.rb:44:in `<main>'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/package_task.rb:1:in `(root)'
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/package_task.rb:24:in `block in <main>'
/Users/heinrich/mck/examples/jar-dependencies/example/Rakefile:1:in `(root)'
/Users/heinrich/mck/examples/jar-dependencies/example/Rakefile:26:in `<main>'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/rake-10.5.0/lib/rake/rake_module.rb:1:in `block in (root)'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/rake-10.5.0/lib/rake/application.rb:94:in `<main>'
org/jruby/RubyKernel.java:1007:in `load'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
org/jruby/RubyKernel.java:1046:in `eval'
/Users/heinrich/.rvm/gems/jruby-9.2.5.0/bin/jruby_executable_hooks:24:in `<main>'

After that even bundle install fails badly:

heinrich@berlin:~/mck/examples/jar-dependencies/example$ bundle install
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant OPENSSL_NO_SOCK
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant TLS_DH_anon_WITH_AES_256_GCM_SHA384
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant HAVE_TLSEXT_HOST_NAME
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant PKCS1_PADDING
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant SSLV23_PADDING
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant NO_PADDING
/Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31: warning: already initialized constant PKCS1_OAEP_PADDING
--- ERROR REPORT TEMPLATE -------------------------------------------------------
# Error Report

## Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

- **What did you do?**

  I ran the command `/Users/heinrich/.rvm/gems/jruby-9.2.5.0/bin/bundle install`

- **What did you expect to happen?**

  I expected Bundler to...

- **What happened instead?**

  Instead, what happened was...

- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**

  I tried...

- **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**

## Backtrace

NameError: cannot load (ext) (org.jruby.ext.openssl.OpenSSL)
  org/jruby/ext/jruby/JRubyUtilLibrary.java:184:in `load_ext'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/jopenssl/load.rb:31:in `<main>'
  org/jruby/RubyKernel.java:983:in `require'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59:in `require'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/openssl.rb:1:in `<main>'
  org/jruby/RubyKernel.java:983:in `require'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59:in `require'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/openssl.rb:1:in `<main>'
  org/jruby/RubyKernel.java:983:in `require'
  /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59:in `require'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendored_persistent.rb:1:in `<main>'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendored_persistent.rb:6:in `<main>'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/fetcher.rb:1:in `block in (root)'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/fetcher.rb:3:in `<main>'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli/install.rb:1:in `(root)'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli/install.rb:53:in `run'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:235:in `install'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/settings.rb:143:in `temporary'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:234:in `install'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `block in dispatch'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `<main>'
  org/jruby/RubyKernel.java:1007:in `load'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
  org/jruby/RubyKernel.java:1046:in `eval'
  /Users/heinrich/.rvm/gems/jruby-9.2.5.0/bin/jruby_executable_hooks:24:in `<main>'

## Environment

Bundler             1.17.1
  Platforms         ruby, universal-java-1.8
Ruby                2.5.0p0 (2018-12-06 revision 60928) [java]
  Full Path         /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/bin/jruby
  Config Dir        /Users/heinrich/.rvm/rubies/jruby-9.2.5.0/etc
RubyGems            2.7.6
  Gem Home          /Users/heinrich/.rvm/gems/jruby-9.2.5.0
  Gem Path          /Users/heinrich/.rvm/gems/jruby-9.2.5.0:/Users/heinrich/.rvm/gems/jruby-9.2.5.0@global
  User Path         /Users/heinrich/.gem/jruby/2.5.0
  Bin Dir           /Users/heinrich/.rvm/gems/jruby-9.2.5.0/bin
OpenSSL
Tools
  Git               2.17.2 (Apple Git-113)
  RVM               1.29.4 (master)
  rbenv             not installed
  chruby            not installed
  rubygems-bundler  (1.4.5)

## Bundler Build Metadata

Built At          2018-10-25
Git SHA           2760d72d3
Released Version  true

## Bundler settings

build.libv8
  Set for the current user (/Users/heinrich/.bundle/config): "--with-system-v8"
gem.test
  Set for the current user (/Users/heinrich/.bundle/config): "rspec"
gem.mit
  Set for the current user (/Users/heinrich/.bundle/config): true
gem.coc
  Set for the current user (/Users/heinrich/.bundle/config): false

## Gemfile

### Gemfile

# bundle install will download and install the jar dependencies
# as well create the lib/example_jars.rb which loads the jars at
# runtime

source 'https://rubygems.org'

gemspec

### Gemfile.lock

PATH
  remote: .
  specs:
    example (2-java)
      jar-dependencies (~> 0.3.0)

GEM
  remote: https://rubygems.org/
  specs:
    diff-lcs (1.3)
    jar-dependencies (0.3.12)
    rake (10.5.0)
    rake-compiler (0.9.9)
      rake
    rspec (2.99.0)
      rspec-core (~> 2.99.0)
      rspec-expectations (~> 2.99.0)
      rspec-mocks (~> 2.99.0)
    rspec-core (2.99.2)
    rspec-expectations (2.99.2)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.99.4)
    ruby-maven (3.3.12)
      ruby-maven-libs (~> 3.3.9)
    ruby-maven-libs (3.3.9)

PLATFORMS
  java

DEPENDENCIES
  example!
  rake (~> 10.3)
  rake-compiler (~> 0.9)
  rspec (~> 2.14)
  ruby-maven (~> 3.3, >= 3.3.8)

BUNDLED WITH
   1.17.1

## Gemspecs

### example.gemspec

ruby
#-*- mode: ruby -*-

Gem::Specification.new do |s|
  # this is only needed to retrieve the latest version of jar-dependencies
  # so this can run as integration-test
  version = ENV_JAVA['jar-dependencies.version'] || '0.3.0'

  s.name = 'example'
  s.version = '2'
  s.author = 'example person'
  s.email = ['mail@example.com']
  s.summary = 'gem with jar'
  s.description = 'gem with empty jar and jar dependencies'

  # important so jar-dependencies knows it should look for
  # jar declarations in the requirements section !
  s.platform = 'java'

  s.files << Dir['lib/**/*.rb']
  s.files << 'lib/example.jar'
  s.files << Dir['*file']
  s.files << 'example.gemspec'

  # constrain the version of jar-dependencies itself
  s.add_runtime_dependency 'jar-dependencies', "~> #{version}"

  # the jar declarations
  s.requirements << 'jar org.bouncycastle:bcpkix-jdk15on, 1.49'
  s.requirements << 'jar org.bouncycastle:bcprov-jdk15on, 1.49'
  s.requirements << 'jar org.slf4j:slf4j-api, 1.7.7'

  # dependency where some transitive dependency gets excluded (jruby comes
  # with joda-time already bundled and this can cause classloader conflicts.
  # better just use the version of joda-time from jruby and hope it is
  # compatible)
  s.requirements << 'jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, :exclusions=> [ joda-time:joda-time ]'

  # a jar dependency with a classifier
  s.requirements << 'jar com.google.protobuf:protobuf-java, 2.2.0, :classifier => lite'

  # needed for the tests
  s.requirements << 'jar junit:junit:4.12, :scope => :test'
  # this is part of the test and assumed to be provided during runtime
  s.requirements << 'jar org.slf4j:slf4j-simple, 1.7.7, :scope => :provided'

  s.add_development_dependency 'rake', '~> 10.3'
  s.add_development_dependency 'rspec', '~> 2.14'

  # needed to compile src/main/java/** into lib/example.jar
  s.add_development_dependency 'rake-compiler', '~> 0.9'

  # avoids to install it on the fly when jar-dependencies needs it
  s.add_development_dependency 'ruby-maven', '~> 3.3', '>= 3.3.8'
end

# vim: syntax=Ruby

--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=cannot+load+%28ext%29+%28org.jruby.ext.openssl.OpenSSL%29&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new

It must be something generated by the previous steps because if I delete the repo and start from scratch I can run the 2 previous steps again, but the 3rd rake fails again.