Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
loading (default) gems varies between jruby 1.7.x versions #1566
the Gem.path changed from 1.7.5 to append the jruby internal path at the end. which matches MRI (as far I can tell)
from 1.7.5 onwards the internal "default" gems get preference over the gems installed somewhere else. 1.7.12-SNAPSHOT/9000.dev does even ignore those installed altogether and only loads the internal ones. same did 1.7.9,1.7.8,1.7.6
1.7.11 sees the jruby-openssl gem and use it.
but jruby-openssl installed outside of jruby is version 0.9.4 and the default gem is version 0.9.3. for bouncy-castle-java gem it 1.7.5 or newer always loads the internal default gems.
however the given Gem.path indicates that the given GEM_PATH is first in the path and I would expect those gems get preference to the gems further behind in the Gem.path - as 1.7.4 does it.
if I add a
altogether I would expect with or without the extra gem 'jruby-openssl' that the externally installed gems have preference as the Gem.path indicates (as 1.7.4 did it) and those krypt gems are used then they are loaded gems, as 1.7.11 does show but 1.7.12-SNAPSHOT not anymore.
it is not clear what is the right behaviour should be.
I was impacted by this issue as well. Identical matter to https://groups.google.com/forum/#!msg/jruby-users/cx-1gODKPWM/zKDREFZqfcYJ
I'm a bit perplexed because it seems like bouncy castle was loaded, but exactly as Michael Pitman did, adding an explicit reference to the BC 147 jars solved the issue. This occurred under jruby 1.7.8-1.7.12 for me.
I'm going to watch this issue and if a fix is proposed then I'll try to confirm as well.
I am still not able to reproduce the issue from Michael.
what exactly do you mean with 'explicit reference to the BC 147 jars' ? I
could you provide me more info on your setup - maybe your setup allows me
I too made a stand-alone app that failed to reproduce the issue. In my case this is a rails app and the reference to the encryption code is quite deep (of course) in my app. The app works fine in my dev (mac) environment but when it gets bundled via warbler and deployed as a war on windows it experiences this issue. Who knows what's triggering the effect!
I've added at the top of my application.rb, right after rails is loaded
and then placed copies of the jar files into my build as shown above. This clears the issue.
While troubleshooting I used the example code to exercise the issue and receive the same exception "Wrong algorithm: DESede or TripleDES required".
Basically I put this in my bundled war file code right before I'd expect to use a private key so that I could confirm that it was this method call that croaks. As you know the initialize method in PKeyRSA.java just tosses these exceptions as it works through a list of different key loading strategies. (That is a costly decision for developers using this code - as the source of the failure is a total mystery and to make things more perplexing my public key loads - now I see why)
I did review the LOAD_PATH and CLASSPATH values and I did see in my CLASSPATH contains:
Confirming the jars are in the jruby jars:
which JDK are you using on windows ? oracle jkd-8 ?
the issue could be similar to
where the problem is how the jar got loaded and gets not verified.
as you say it is difficult to see the real cause of the problem since a lot
one more thing to test would be to build the ext/openssl gem from jruby git
and use the pkg/jruby-openssl-0.9.5.gem for you tests. here Kares took some
thanx for all the help . . . .
On Tue, May 6, 2014 at 2:23 PM, jayjlawrence email@example.com:
Reading through the problem it seems that this could be related. What tipped me off is the that the Ciphers were not initialized when this problem occurs - and so the proposed cause seems plausible.
I'm running Oracle 1.7.0_45-b15 on Windows. On Mac Oracle 1.7.0_25-b15
Thanks for the openssl build process ... so if I just load the openssl 0.9.5 into my current app that's running JRuby 1.7.12 I will be ok, or should I build 1.7.13-snapshot?
Unfortunately the builds don't work for me at this time....I've got the head of the master branch checked out and ext/openssl give this error:
[ERROR] COMPILATION ERROR :
and the jruby package over all fails with:
[INFO] 1 error