Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Installing via HTTPS fails when using JRuby #1621

Closed
cfbrobak opened this issue Jan 12, 2012 · 14 comments
Closed

Installing via HTTPS fails when using JRuby #1621

cfbrobak opened this issue Jan 12, 2012 · 14 comments

Comments

@cfbrobak
Copy link

Environment

  • jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) Client VM 1.6.0_21) [Windows XP-x86-java]
  • Bundler 1.0.21

Problem

Even though gem "jruby-openssl" is installed alongside "bundler" in the system repository it is not found when running "bundle install " and having HTTPS in the source definition. The command fails fails with:

Fetching source index for https://rubygems.org/
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
LoadError: OpenSSL::SSL requires the jruby-openssl gem
                  (root) at C:/apps/jruby/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8
                use_ssl= at C:/apps/jruby/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:124
          connection_for at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:317
                 request at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:368
              fetch_http at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:203
                    send at org/jruby/RubyKernel.java:2105
              fetch_path at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:231
              load_specs at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:258
              load_specs at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:72
                    list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:231
                    each at org/jruby/RubyArray.java:1612
                    list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:227
                    list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:63
  fetch_all_remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:253
            remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:234
                    each at org/jruby/RubyArray.java:1612
            remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:231
             fetch_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:165
                   specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:70
                   index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:159
                    each at org/jruby/RubyArray.java:1612
                   index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:158
                   build at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/index.rb:7
                   index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:157
                 resolve at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:151
                   specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:90
       resolve_remotely! at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:85
                     run at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/installer.rb:41
                 install at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/installer.rb:8
                 install at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/cli.rb:219
                    send at org/jruby/RubyKernel.java:2093
                     run at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:21
             invoke_task at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118
                dispatch at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263
                   start at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386
                  (root) at C:/apps/jruby-gems/gems/bundler-1.0.21/bin/bundle:13
                    load at org/jruby/RubyKernel.java:1063
                  (root) at C:\Apps\jruby-gems\bin\bundle:19

My guess is that Bundler changes the Gem.path before the "require 'openssl'" is issued. If I add a "require 'openssl'" to the Bundler launch script, it works.

I have also tried using Bundler 1.1.rc.7 and the problem is the same.

@indirect
Copy link
Member

Seems like we should add something that conditionally tries to require OpenSSL if we're running on jruby.

On Jan 12, 2012, at 3:04 AM, cfbrobakreply@reply.github.com wrote:

Environment

  • jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (Java HotSpot(TM) Client VM 1.6.0_21) [Windows XP-x86-java]
  • Bundler 1.0.21

Problem

Even though gem "jruby-openssl" is installed alongside "bundler" in the system repository it is not found when running "bundle install " and having HTTPS in the source definition. The command fails fails with:

Fetching source index for https://rubygems.org/
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
LoadError: OpenSSL::SSL requires the jruby-openssl gem
                 (root) at C:/apps/jruby/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8
               use_ssl= at C:/apps/jruby/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:124
         connection_for at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:317
                request at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:368
             fetch_http at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:203
                   send at org/jruby/RubyKernel.java:2105
             fetch_path at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:231
             load_specs at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:258
             load_specs at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:72
                   list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:231
                   each at org/jruby/RubyArray.java:1612
                   list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:227
                   list at C:/apps/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:63
 fetch_all_remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:253
           remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:234
                   each at org/jruby/RubyArray.java:1612
           remote_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:231
            fetch_specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:165
                  specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/source.rb:70
                  index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:159
                   each at org/jruby/RubyArray.java:1612
                  index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:158
                  build at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/index.rb:7
                  index at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:157
                resolve at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:151
                  specs at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:90
      resolve_remotely! at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/definition.rb:85
                    run at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/installer.rb:41
                install at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/installer.rb:8
                install at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/cli.rb:219
                   send at org/jruby/RubyKernel.java:2093
                    run at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:21
            invoke_task at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118
               dispatch at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263
                  start at C:/apps/jruby-gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386
                 (root) at C:/apps/jruby-gems/gems/bundler-1.0.21/bin/bundle:13
                   load at org/jruby/RubyKernel.java:1063
                 (root) at C:\Apps\jruby-gems\bin\bundle:19

My guess is that Bundler changes the Gem.path before the "require 'openssl'" is issued. If I add a "require 'openssl'" to the Bundler launch script, it works.

I have also tried using Bundler 1.1.rc.7 and the problem is the same.


Reply to this email directly or view it on GitHub:
#1621

@cfbrobak
Copy link
Author

I probably should add that it only fails if option "--path" and/or "--deployment" is used, that is, when BUNDLE_PATH is set to something different from the system repository.

@olbrich
Copy link

olbrich commented Feb 29, 2012

It is possible to work around this issue by changing the source to use http instead of https

@xaviershay
Copy link
Contributor

Can replicate on bundler 1.1.0 and JRuby 1.6.7.

@woodbomb50
Copy link

I'm a noobie, so I'm not sure if this is a new issue or old.

I'm using the RubyMine 4.02 IDE.

\jruby-1.6.5.1\bin\jruby.exe C:\jruby-1.6.5.1\bin/bundle install jruby-openssl
Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
ArgumentError: wrong number of arguments (1 for 0)
send at org/jruby/RubyKernel.java:2097
run at C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/bundler-1.1.2/lib/bundler/vendor/thor/task.rb:21
invoke_task at C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/bundler-1.1.2/lib/bundler/vendor/thor/invocation.rb:118
dispatch at C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/bundler-1.1.2/lib/bundler/vendor/thor.rb:263
start at C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/bundler-1.1.2/lib/bundler/vendor/thor/base.rb:386
(root) at C:/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/bundler-1.1.2/bin/bundle:13
load at org/jruby/RubyKernel.java:1063
(root) at C:\jruby-1.6.5.1\bin/bundle:19

Process finished with exit code 1

@bbhoss
Copy link

bbhoss commented Mar 28, 2012

This bit me today, would love a fix.

@liveh2o
Copy link

liveh2o commented Apr 5, 2012

I can replicate with bundler 1.1.3 and JRuby 1.6.7. It works if I just run bundle install, but bombs when running with the --path option.

@samerbuna
Copy link

I can replicate with bundler 1.1.3 and 1.0.22. It worked when using http

@ept
Copy link

ept commented Apr 23, 2012

Can also replicate (Bundler 1.1.3, JRuby 1.6.7). For those of us with private gem repositories that must be accessed over https, a workaround is to avoid the --path option (and use e.g. an RVM gemset instead).

@carlhoerberg
Copy link

if you require openssl beforehand (and has jruby-openssl installed) it works:

jruby -r openssl -S bundle install --path vendor/bundle

@ept
Copy link

ept commented Apr 24, 2012

@carlhoerberg Best workaround so far. Thank you!

davidcelis pushed a commit to davidcelis/bundler that referenced this issue Aug 23, 2012
By default, most Gemfiles use https://rubygems.org/ as their source, and
rightly so. SSL is a good default to maintain. However, bundling on the
JRuby platform has had issues for a long time now, usually throwing
`LoadError: OpenSSL::SSL requires the jruby-openssl gem`. This is a
problem I see repeatedly on Rails applications generated under JRuby,
despite having `gem 'jruby-openssl'` in the Gemfile. Bundler dies before
the gem can be installed, however; even having `jruby-openssl`
preinstalled would fail.

This patch adds a `require` statement for `'openssl'` in the place that
seemed most logical to me, `lib/bundler/fetcher.rb`. After adding this
require statement, bundling via HTTPS has worked flawlessly.

Fixes issues rubygems#1621, rubygems#1819, rubygems#1975 (closed), and rubygems#1996 (closed).

Signed-off-by: David Celis <david@davidcelis.com>
@dhruvbansal
Copy link

Still seeing this issue. JRuby 1.6.5 in 1.9 mode. Bundler v. 1.1.5.

@indirect
Copy link
Member

indirect commented Sep 6, 2012

@dhruvbansal Yup, it's still the same as it's always been. :P

@rohitarondekar
Copy link
Contributor

ee48b35 should fix this issue, if it's still not working leaving a comment and I'll reopen the issue.

brettporter pushed a commit to brettporter/bundler that referenced this issue Nov 28, 2012
By default, most Gemfiles use https://rubygems.org/ as their source, and
rightly so. SSL is a good default to maintain. However, bundling on the
JRuby platform has had issues for a long time now, usually throwing
`LoadError: OpenSSL::SSL requires the jruby-openssl gem`. This is a
problem I see repeatedly on Rails applications generated under JRuby,
despite having `gem 'jruby-openssl'` in the Gemfile. Bundler dies before
the gem can be installed, however; even having `jruby-openssl`
preinstalled would fail.

This patch adds a `require` statement for `'openssl'` in the place that
seemed most logical to me, `lib/bundler/fetcher.rb`. After adding this
require statement, bundling via HTTPS has worked flawlessly.

Fixes issues rubygems#1621, rubygems#1819, rubygems#1975 (closed), and rubygems#1996 (closed).

Signed-off-by: David Celis <david@davidcelis.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests