Thanks to visit codestin.com
Credit goes to github.com

Skip to content

jruby-complete doesn't load psych properly when SnakeYAML 1.23 is in classpath #5573

@mouyang

Description

@mouyang

Environment

  • Asciidoctorj-pdf 1.5.0-alpha.14 which depends on jruby-complete-9.1.8.0
  • Spring Boot 2.1.2.RELEASE + other dependencies introduces SnakeYAML 1.23 into the classpath

Expected Behavior

  • I expect to be able to call Asciidoctor.convertFile (or do anything with Asciidoctor for that matter) without errors.
  • More specifically, the transitive SnakeYAML 1.23 dependency should not interfere with jruby-complete-9.1.8.0 because it bundles a compatible SnakeYAML jar.
  • A similar issue is described here When using JRuby 9.x SnakeYaml needs to be on the classpath. asciidoctor/asciidoctorj-pdf#16. The user needs to include SnakeYAML manually in order to proceed. This should not be necessary.

Actual Behavior

  • jruby-complete-9.1.8.0 embeds SnakeYAML 1.18 but it appears like it is being ignored in favour of SnakeYAML 1.23 and causing the error and exception below.
  • If I downgrade SnakeYAML 1.19, I am able to proceed. This however is not desirable because there are backwards-incompatible changes between 1.19 and 1.23, and I don't want to risk runtime errors in production.
  • Upgrading to SnakeYAML 1.23-compatible version of Asciidoctorj-pdf didn't work right away. However I don't know if that is related to the issues I am experiencing.

Error and Exception

uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in `require':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

org.jruby.exceptions.RaiseException: (LoadError) load error: psych -- java.lang.ExceptionInInitializerError: null
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at RUBY.

(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/yaml.rb:6)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.(root)(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1)
at RUBY.(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.(root)(uri:classloader:/gems/prawn-icon-1.3.0/lib/prawn/icon/font_data.rb:9)
at RUBY.(uri:classloader:/jruby/kernel/kernel.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.require_relative(uri:classloader:/jruby/kernel/kernel.rb:13)
at RUBY.(uri:classloader:/gems/prawn-icon-1.3.0/lib/prawn/icon.rb:10)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.(root)(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1)
at RUBY.(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.(root)(uri:classloader:/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/prawn_ext/extensions.rb:3)
at RUBY.(uri:classloader:/jruby/kernel/kernel.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.require_relative(uri:classloader:/jruby/kernel/kernel.rb:13)
at RUBY.(uri:classloader:/gems/asciidoctor-pdf-1.5.0.alpha.14/lib/asciidoctor-pdf/prawn_ext.rb:5)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:961)
at RUBY.(root)(uri:classloader:/jruby/kernel/kernel.rb:1)
at RUBY.(uri:classloader:/jruby/kernel/kernel.rb:13)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions