jruby-openssl fails to load but reports no error
------------------------------------------------
Key: JRUBY-3195
URL: http://jira.codehaus.org/browse/JRUBY-3195
Project: JRuby
Issue Type: Bug
Components: OpenSSL
Affects Versions: JRuby 1.1.5
Environment: Windows XP, JRuby 1.1.5 *with* jruby-openssl gem installed
Reporter: Tom Robinson
When trying to use jruby-openssl within a script where a "Config" class is
already in the namespace, jruby-openssl will fail to load but report no error.
Instead it falls back to the built in openssl support and reports:
"JRuby limited openssl loaded. gem install jruby-openssl for full support."
It should not be reporting this, as the jruby-openssl gem *is* installed.
An example of this occuring in jirb:
-----------------------------------------
irb(main):001:0> class Config ; end
=> nil
irb(main):002:0> Config.class
=> Class
irb(main):003:0> require 'net/http'
=> true
irb(main):004:0> require 'net/https'
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
=> true
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
from C:/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:62:in `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:in `require'
from C:/jruby/lib/ruby/site_ruby/1.8/jruby/openssl/gem.rb:3
from C:/jruby/lib/ruby/site_ruby/1.8/jruby/openssl/gem.rb:124:in
`use_ssl='
from (irb):7
from C:/jruby/lib/ruby/1.8/irb.rb:150:in `eval_input'
from C:/jruby/lib/ruby/1.8/irb.rb:259:in `signal_status'
from C:/jruby/lib/ruby/1.8/irb.rb:147:in `eval_input'
from C:/jruby/lib/ruby/1.8/irb.rb:146:in `eval_input'
from C:/jruby/lib/ruby/1.8/irb.rb:70:in `start'
from C:/jruby/lib/ruby/1.8/irb.rb:69:in `catch'
from C:/jruby/lib/ruby/1.8/irb.rb:69:in `start'
from c:\jruby\bin\jirb:19
irb(main):007:0>
-----------------------------------------
To work around the problem, I have renamed the Config class in the script in
question. If Config is not in the namespace, then everything works fine:
-----------------------------------------
irb(main):001:0> defined? Config
=> nil
irb(main):002:0> require 'net/http'
=> true
irb(main):003:0> require 'net/https'
=> true
irb(main):004:0> h = Net::HTTP.new('www.test.com', 443)
=> #<Net::HTTP www.test.com:443 open=false>
irb(main):005:0> h.use_ssl = true
=> true
irb(main):006:0> defined? Config
=> "constant"
irb(main):007:0> Config.class
=> Module
-----------------------------------------
Notice that "JRuby limited openssl loaded. gem install jruby-openssl for full
support." does not appear the second time around.
As can be seen above, jruby-openssl is creating a "Config" module, which in the
first example is conflicting with the existing "Config" class. So there is a
namespace clash, but no error is raised.
Original email thread on this issue is here:
http://markmail.org/message/r6jr3zwlfw6asija
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email