I have encountered some odd behaviour with jruby-openssl, but I am not
if this is a bug or a feature.
I am running JRuby 1.1.5 on Windows XP with the jruby-openssl gem
I am trying to make an HTTPS request from a piece of code that creates a
class called Config.
It seems that the existance of the Config class is causing “require
‘net/https’” to fail and fall back to the limited openssl that comes
with JRuby. This then causes an odd error later on. As an example, in
irb(main):001:0> class Config ; end
irb(main):003:0> require ‘net/http’
irb(main):004:0> require ‘net/https’
JRuby limited openssl loaded. gem install jruby-openssl for full
irb(main):005:0> h = Net::HTTP.new(‘www.test.com’, 443)
=> #<Net::HTTP www.test.com:443 open=false>
irb(main):006:0> h.use_ssl = true
TypeError: #Class:01x1398cac is not a module
require' from C:/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:62 from C:/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:3:inrequire’
use_ssl=' from (irb):7 from C:/jruby/lib/ruby/1.8/irb.rb:150:ineval_input’
signal_status' from C:/jruby/lib/ruby/1.8/irb.rb:147:ineval_input’
eval_input' from C:/jruby/lib/ruby/1.8/irb.rb:70:instart’
catch' from C:/jruby/lib/ruby/1.8/irb.rb:69:instart’
This can be worked around by renaming the Config class to something
and the code works fine like that, but I would have expected “require
‘net/https’” to have thrown an error to indicate that the require had
attempted to use jruby-openssl and failed, falling back to the built in
The reason for this seems to be that jruby-openssl creates a module
Config, which it cannot do if the symbol Config is already in use. But
something is suppressing the exception that I would normally expect.
Is this a bug?