wu-sheng opened a new pull request, #812:
URL: https://github.com/apache/skywalking-java/pull/812

   ### Fix `plugin.http.include_http_headers` not working on Spring Boot 3.x / 
Jakarta EE (Spring MVC 6.x)
   
   Closes #13938.
   
   **Why the bug exists:** the Spring MVC commons detected the servlet 
namespace with a static `Class.forName` flag-dance (`IS_JAVAX`/`IS_JAKARTA`). 
When both `javax.servlet` and `jakarta.servlet` are on the classpath (common on 
Spring Boot 3.x, where `javax.servlet-api` is often present transitively), the 
detection mis-classifies the live Jakarta request, the Spring MVC entry span 
throws `IllegalStateException`, it is swallowed, and `http.headers` is silently 
dropped.
   
   **How it is fixed:** add a shared `servlet-commons` module — a JDK-typed, 
namespace-agnostic servlet request/response wrapper 
(`HttpRequestWrappers.wrap(Object)` / `HttpResponseWrappers.wrap(Object)`) that 
resolves `javax.servlet` vs `jakarta.servlet` at runtime through a single, 
classloading-safe dispatch point (each namespace confined to a nested class 
behind a short-circuit guard). The Spring MVC commons interceptor routes 
through it, removing the fragile static detection.
   
   While unifying the servlet-namespace handling, the duplicated servlet plugin 
pairs are merged into one plugin each, both covering `javax.servlet` and 
`jakarta.servlet`:
   - `tomcat-7.x-8.x` + `tomcat-10x` → **`tomcat`** (Tomcat 7 – 10)
   - `jetty-server-9.x` + `jetty-server-11.x` → **`jetty-server`** (Jetty 9 – 
11)
   
   **⚠️ Breaking change:** the plugin definition names change accordingly. 
Update any `plugin.exclude_plugins` (`SW_EXCLUDE_PLUGINS`) settings that 
reference the old names.
   
   - [x] Add a unit test to verify that the fix works. (`servlet-commons` 
`HttpRequestWrappersTest` / `HttpResponseWrappersTest` — both servlet APIs on 
the test classpath, the exact trigger condition; plus the ported 
`TomcatInvokeInterceptorTest` / `HandleInterceptorTest` on the merged modules.)
   - [x] Explain briefly why the bug exists and how to fix it.
   
   New E2E scenarios reproduce the reported environment (both verified passing 
on the local plugin-test runner):
   - `spring-boot-3.x-scenario` — Spring Boot 3 + embedded Tomcat 10 (jakarta) 
+ Spring MVC 6, asserting `http.headers` + `http.params` on the entry span
   - `spring-boot-2.x-scenario` — Spring Boot 2 (javax) mirror
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace 
the issue number. Closes #13938.
   - [x] Update the [`CHANGES` 
log](https://github.com/apache/skywalking-java/blob/main/CHANGES.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to