How do I resolve exception when creating a rubyGems repository?

On JDK 7u45 and later (including JDK 8), when creating a rubyGems local repository you get an exception:


2014-05-28 03:05:54,044 [art-exec-6] [INFO ] (o.a.a.g.h.RubyHelper:141) – Initialized RubyHelper successfully

2014-05-28 03:05:57,151 [art-exec-6] [INFO ] (o.a.e.UploadServiceImpl:474) – Deploy to ‘gem-local:quick/Marshal.4.8/rubygems-update-2.0.6.gemspec.rz’ Content-Length: 859

SystemStackError: stack level too deep

                      each at jar:file:/C:/software/artifactory-powerpack-3.1.1.1/tomcat/work/Catalina/localhost/artifactory/WEB-INF/lib/jruby-stdlib-1.7.4.jar!

/META-INF/jruby.home/lib/ruby/shared/rubygems/package/tar_reader.rb:64

                      loop at org/jruby/RubyKernel.java:1489

                      each at jar:file:/C:/software/artifactory-powerpack-3.1.1.1/tomcat/work/Catalina/localhost/artifactory/WEB-INF/lib/jruby-stdlib-1.7.4.jar!

…..


This issue is related to JRuby use of the JDK’s invokedynamic;  see here for details.


As a workaround you can add the ” -Djruby.compile.invokedynamic=false” param to the current Java environment parameters as below:

  1. Alter Java’s Environment parameters by making changes to the JAVA_OPTIONS environment variable, in “$ARTIFACTORY_HOME/bin/artifactory.default”
  2. export JAVA_OPTIONS=”$JAVA_OPTIONS -Djruby.compile.invokedynamic=false”


Please see this Jira ticket for more details.