Skip to content

InvokeDynamicSupport.findVirtual fails with IllegalAccessException: symbolic reference class is not accessible #8987

@rsim

Description

@rsim

Environment Information

  • jruby 10.0.2.0 (3.4.2) 2025-08-07 cba6031bd0 OpenJDK 64-Bit Server VM 21.0.8+9-LTS on 21.0.8+9-LTS +indy +jit [arm64-darwin]
  • Both on local macOS 15.5 and in GitHub CI actions

Expected Behavior

https://github.com/rsim/mondrian-olap/ tests are running successfully on JRuby 9.4.x and Java 8, 11, 17, 21.

Actual Behavior

When trying to run https://github.com/rsim/mondrian-olap/ tests on JRuby 10.0.2.0 (as well as with previous 10.0.0.0 and 10.0.1.0 versions) and Java 21 then the following line https://github.com/rsim/mondrian-olap/blob/master/lib/mondrian/olap/result.rb#L277 fails with

     Failure/Error: Unable to find org.jruby.dist/org.jruby.runtime.invokedynamic.InvokeDynamicSupport.findVirtual(InvokeDynamicSupport.java to read failed line

     Java::JavaLang::RuntimeException:
       java.lang.IllegalAccessException: symbolic reference class is not accessible: class jdk.proxy4.$Proxy49, from class org.jruby.runtime.invokedynamic.InvokeDynamicSupport (module org.jruby.dist)
     # org.jruby.dist/org.jruby.runtime.invokedynamic.InvokeDynamicSupport.findVirtual(InvokeDynamicSupport.java:85)
     # org.jruby.dist/org.jruby.ir.targets.indy.JavaBootstrap.createJavaHandle(JavaBootstrap.java:104)
     # org.jruby.dist/org.jruby.ir.targets.indy.InvokeSite.buildNativeHandle(InvokeSite.java:441)
     # org.jruby.dist/org.jruby.ir.targets.indy.InvokeSite.getHandle(InvokeSite.java:1153)
     # org.jruby.dist/org.jruby.ir.targets.indy.InvokeSite.invoke(InvokeSite.java:781)
     # home.runner.work.mondrian_minus_olap.mondrian_minus_olap.lib.mondrian.olap.result.️❤ def metadata #0(/home/runner/work/mondrian-olap/mondrian-olap/lib/mondrian/olap/result.rb:277)

See the full stack trace in https://github.com/rsim/mondrian-olap/actions/runs/17355575188/job/49268038963?pr=141

When I run the tests with JRUBY_OPTS="--dev" then they are successful. So it happens only when "invoke dynamic" is used.

When I examine the failing @raw_result_set.java_class I get this jdk.proxy4.$Proxy49 or similar.

As a workaround I found that if I replace

@raw_result_set.getMetaData

with

method = @raw_result_set.java_class.java_method(:getMetaData)
method.accessible = true
method.invoke(@raw_result_set)

then the call was successful. But this isn't a good workaround as many such methods could start failing in production when they don't fail in development when --dev flag is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions