open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Dubbo Filters Failing to Load in Spring Boot Maven Plugin Versions 1.3.8.RELEASE or earlier
Nobody has claimed this yet.
- 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:
- 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. - Resource Injection:
The Javaagent instruments ClassLoader.getResources() to inject these resources:
ResourceInjectionInstrumentation.java#L80-L113. - 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
- Use
spring-boot-maven-plugin1.3.8.RELEASE or earlier to produce a jar of Dubbo's demo. - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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