Skip to content

[GR-71126][Native Image] Proxy access fails on CI but passes locally #12417

@mhalbritter

Description

@mhalbritter

Describe the Issue

We have a very strange problem which only happens on our CI.

This is the output from our CI:

https://github.com/spring-projects/spring-aot-smoke-tests/actions/runs/18744515842/job/53468498318

and here's the Gradle build scan:

https://ge.spring.io/s/w3d5pjzywb5qg/tests/task/:data:data-mongodb:nativeAppTest/details/com.example.data.mongodb.DataMongoDbApplicationAotTests/findAll(AssertableOutput)?top-execution=1

That's the relevant part:

    "java.lang.RuntimeException: org.graalvm.nativeimage.MissingReflectionRegistrationError: Cannot reflectively access the proxy class inheriting ['java.util.SequencedCollection','org.springframework.data.mongodb.core.convert.LazyLoadingProxy','java.util.List','org.springframework.aop.SpringProxy','org.springframework.aop.framework.Advised','org.springframework.core.DecoratingProxy']. To allow this operation, add the following to the 'reflection' section of 'reachability-metadata.json' and rebuild the native image:",	
    "",	
    "  {",	
    "    "type": {",	
    "      "proxy": [",	
    "        "java.util.SequencedCollection",",	
    "        "org.springframework.data.mongodb.core.convert.LazyLoadingProxy",",	
    "        "java.util.List",",	
    "        "org.springframework.aop.SpringProxy",",	
    "        "org.springframework.aop.framework.Advised",",	
    "        "org.springframework.core.DecoratingProxy"",	
    "      ]",	
    "    }",	
    "  }",	
    "",

However, the Spring-generated reachability-metadata.json (it's located in data/data-mongodb/build/generated/aotResources/META-INF/native-image/spring-aot-smoke-tests.data/data-mongodb/reachability-metadata.json after build) contains this snippet:

    {
      "type": {
        "proxy": [
          "java.util.SequencedCollection",
          "org.springframework.data.mongodb.core.convert.LazyLoadingProxy",
          "java.util.List",
          "org.springframework.aop.SpringProxy",
          "org.springframework.aop.framework.Advised",
          "org.springframework.core.DecoratingProxy"
        ]
      }
    },

When running the test locally, using the same GraalVM version as CI, this is not reproducible and the test passes.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

openjdk version "25.0.1" 2025-10-21
OpenJDK Runtime Environment GraalVM CE 25.0.1+8.1 (build 25.0.1+8-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 25.0.1+8.1 (build 25.0.1+8-jvmci-b01, mixed mode, sharing)

Operating System and Version

CI is using ubuntu-latest, I've tested with Ubuntu 24.04.3: Linux ubuntu-2404 6.8.0-86-generic #87-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 22 18:03:36 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Troubleshooting Confirmation

Run Command

git clone https://github.com/spring-projects/spring-aot-smoke-tests
cd spring-aot-smoke-tests/
git switch main
cd data/data-mongodb
../../gradlew nativeAppTest

Expected Behavior

Test passes.

Actual Behavior

Test fails.

Steps to Reproduce

See run command

Additional Context

It only fails on CI. It works on a Fedora 41 machine, and it works in a Ubuntu 24.04.3 virtual machine. It also passes on a mac.

Run-Time Log Output and Error Messages

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions