Skip to content

[Bug] JDK 25's ServiceLoader iterator may throw exception in hasNext #15747

@hu-chia

Description

@hu-chia

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

JDK 25's ServiceLoader.load iterator could throw a throwable, in this case, it's NoClassDefFoundError if an implementation's requirments of JavaUtil are not satisfied.

Ref: https://bugs.openjdk.org/browse/JDK-8350481?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

for (Iterator<JsonUtil> it = loader.iterator(); it.hasNext(); ) {

Steps to reproduce this issue

  1. Construct a project without fastjson(fastjson1)
  2. Upgrade to JDK 25
  3. Start dubbo.

What you expected to happen

Just skip the unsupported implementations.

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedEverything needs help from contributors

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions