load error: jruby-openssl for JRuby 1.7.3
When starting the rails server using Jruby 1.7.3:
LoadError: load error: jruby-openssl -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
require at org/jruby/RubyKernel.java:1027
require at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/bundler-1.3.5/lib/bundler/runtime.rb:72
each at org/jruby/RubyArray.java:1613
require at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/bundler-1.3.5/lib/bundler/runtime.rb:70
each at org/jruby/RubyArray.java:1613
require at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/bundler-1.3.5/lib/bundler/runtime.rb:59
require at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/bundler-1.3.5/lib/bundler.rb:132
(root) at /Users/smthmarketable/Documents/Code/NBConcept/Projects/Messenger/config/application.rb:14
require at org/jruby/RubyKernel.java:1027
(root) at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/railties-3.2.13/lib/rails/commands.rb:1
tap at org/jruby/RubyKernel.java:1771
(root) at /Library/Frameworks/JRuby.framework/Gems/1.9/gems/railties-3.2.13/lib/rails/commands.rb:53
require at org/jruby/RubyKernel.java:1027
(root) at script/rails:6
Note that I am using jruby-openssl 0.7.8. If I switch to jruby-openssl 0.7.7, the server seems to work but it still throws a few SEVERE errors when I use it.
I can confirm this as well. However downgrading seems to work for me.
Same story here. jruby-openssl (0.8.8) / Ubuntu
I have a similar problem with JRuby 1.7.3, bundler 1.3.5, rvm 1.18.5 and a sinatra app. The first class encountered that loads net/https causes the error. I'm not explicitly installing openssl or bouncy-castle: I'm relying on them being in JRuby stdlib. The problem does not occur if I revert to JRuby 1.7.2.
Note that I'm also getting warnings for doubly-defined openssl constants like:
/Users/andyb/.rvm/rubies/jruby-1.7.3/lib/ruby/shared/openssl.rb:25 warning: already initialized constant PKCS1_PADDING
I can reproduce by just requiring net/https in the interpreter:
$ rvm use 1.7.3 Using /Users/andyb/.rvm/gems/jruby-1.7.3 $ gem list
*** LOCAL GEMS ***
bundler (1.3.5) rake (10.0.3) rubygems-bundler (1.1.1) $ ruby -e 'require "net/https"' LoadError: load error: openssl -- java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final >method equals.(Ljava/lang/Object;)Z require at org/jruby/RubyKernel.java:1027 require at /Users/andyb/.rvm/rubies/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:36 (root) at /Users/andyb/.rvm/rubies/jruby-1.7.3/lib/ruby/1.9/net/https.rb:22 require at org/jruby/RubyKernel.java:1027 (root) at /Users/andyb/.rvm/rubies/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:1 (root) at -e:1
For comparison:
$ rvm use 1.7.2 Using /Users/andyb/.rvm/gems/jruby-1.7.2 $ ruby -e 'require "net/https"' $
+1. I'm using JRuby 1.7.4. I'm not using none of these libraries directly.
I have the same problem. Windows 7, Jruby 1.7.3, JDK 7, jruby-openssl 0.9.2
We eventually tracked down the issue: turns out that there was a stray copy of the Java SSL libs in a system library directory (OS-X). JRuby 1.7.3 and above must (I assume) be less tolerant of such things.
I tracked this down for a StackOverflow question. I believe the root problem is that this gem packages the bcprov JAR with a version of Bouncy Castle that is incompatible with versions of Bouncy Castle shipped with JRuby (or JRuby-OpenSSL).
Great to know, but feels like there is not much we can do about it ?
Resolution is to update BouncyCastle to version compatible with this shiped with JRuby. And in code you should detect if there is bouncy castle in classpath allready. But this may not be easy task due to recently API breaking changes in BouncyCastle.
I'm having the same problem with:
- Windows XP, JDK 7, JRuby 1.7.11, Rails 4.0.4
- Red Hat, JDK 6, JRuby 1.7.11, Rails 4.0.4