open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Dubbo Filters Failing to Load in Spring Boot Maven Plugin Versions 1.3.8.RELEASE or earlier

Open
#13,623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 16h
Merged PRs (30d)
214

Description

Describe the bug

A specific issue occurs when using Spring Boot Maven Plugin 1.3.8.RELEASE or earlier with Dubbo, where SPI-based filters like OpenTelemetryServerFilter fail to load. This is caused by an incompatibility in the LaunchedURLClassLoader implementation of older Spring Boot versions.
Problem Analysis:
The issue arises due to the way resources are loaded via SPI (Service Provider Interface) in Dubbo. Here's the breakdown:

  1. SPI Registration:
    The OpenTelemetry filters are registered via SPI in the file:
    META-INF/org.apache.dubbo.rpc.Filter.
    This is managed by the instrumentation module here:
    DubboInstrumentationModule.java#L32-L36.
  2. Resource Injection:
    The Javaagent instruments ClassLoader.getResources() to inject these resources:
    ResourceInjectionInstrumentation.java#L80-L113.
  3. Resource Lookup Failure:
    In Spring Boot Maven Plugin 1.3.8.RELEASE or earlier, the LaunchedURLClassLoader overrides getResource() in a way that skips the parent classloader (AppClassLoader):
    Faulty Code:
    LaunchedURLClassLoader.java#L71-L77.
    Line 74 explicitly avoids delegating to the parent, which breaks the expected resource lookup path.
    Fix:
    The Spring team resolved this in Spring Boot 1.4.x by ensuring parent classloaders are properly queried.
    Commit Fix.
Steps to reproduce
  1. Use spring-boot-maven-plugin 1.3.8.RELEASE or earlier to produce a jar of Dubbo's demo.
  2. We can see related filters cannot be loaded.
Expected behavior

Use spring-boot-maven-plugin 1.3.8.RELEASE or earlier to produce a jar of Dubbo's demo, Dubbo’s related filters can be loaded successfully.

Actual behavior

Use spring-boot-maven-plugin 1.3.8.RELEASE or earlier to produce a jar of Dubbo's demo, we can see related filters cannot be loaded.

Javaagent or library instrumentation version

2.14.0

Environment

JDK: JDK 1.8
OS: Linux

Additional context

It may not just be Dubbo. Other plugins that have similar behaviors of injecting resources will be affected. Do we need to explain this in the documentation?
Workaround: Upgrade to Spring Boot Maven Plugin 1.4.x or later.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Dubbo demo with spring-boot-maven-plugin 1.3.8.RELEASE or earlier, then read ResourceInjectionInstrumentation.java and the referenced LaunchedURLClassLoader implementation. Check how the META-INF/org.apache.dubbo.rpc.Filter resource is discovered. Done should be a confirmed project change or clear documentation of the incompatibility and the upgrade workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.