How should I resolve LoadError for java/util/List in JRuby?

43 Views Asked by At

I am trying to use the sass-embedded rubygem with JRuby. sass-embedded has a dependency on Google's Protocol Buffers which I have installed. Now whenever I try to run a ruby script with require 'sass-embedded' I am getting the following error -

LoadError: load error: google/protobuf/descriptor_pb -- java.lang.NoSuchMethodError: com.google.protobuf.Descriptors$Descriptor.getRealOneofs()Ljava/util/List;
           require at org/jruby/RubyKernel.java:1017
           require at <JRuby_dir>/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:160
            <main> at <JRuby_dir>/lib/ruby/gems/shared/gems/google-protobuf-3.23.1-java/lib/google/protobuf/descriptor_dsl.rb:9
           require at org/jruby/RubyKernel.java:1017
           require at <JRuby_dir>/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:96
            <main> at <JRuby_dir>/lib/ruby/gems/shared/gems/google-protobuf-3.23.1-java/lib/google/protobuf.rb:56
           require at org/jruby/RubyKernel.java:1017
           require at <JRuby_dir>/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:96
            <main> at <JRuby_dir>/lib/ruby/gems/shared/gems/sass-embedded-1.58.3/ext/sass/embedded_sass_pb.rb:4
           require at org/jruby/RubyKernel.java:1017
  require_relative at org/jruby/RubyKernel.java:1045
            <main> at <JRuby_dir>/lib/ruby/gems/shared/gems/sass-embedded-1.58.3/lib/sass/embedded.rb:4
           require at org/jruby/RubyKernel.java:1017
  require_relative at org/jruby/RubyKernel.java:1045
            <main> at <JRuby_dir>/lib/ruby/gems/shared/gems/sass-embedded-1.58.3/lib/sass-embedded.rb:4
           require at org/jruby/RubyKernel.java:1017
           require at <JRuby_dir>/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:160
            <main> at my_file.rb:1

my_file.rb

require 'sass-embedded'

Descriptor.getRealOneOffs()


  • sass-embedded version - 1.58.3
  • google-protobuf version - 3.23.1
  • jruby -v -> jruby 9.3.6.0 (2.6.8) 2022-06-27 7a2cbcd376 OpenJDK 64-Bit Server VM 25.332-b08 on 1.8.0_332-b08 +jit [x86_64-linux]

How do I go about debugging this error? From my understanding it's saying that it cannot find java/util/List class. But I don't get why that's happening. Shouldn't it be able to find that from the JDK it's using to run itself?


Note - I am trying to run this program at my work. My workplace uses internal build tools for everything, so it may very well be a bug with those tools. But I don't know where to look right now to solve the issue. If someone can help me figure out that x is the reason this problem occurs, then I'll try to implement the fix for that x in the build tools used at my workplace.

0

There are 0 best solutions below