liudantop opened a new issue #5197:
URL: https://github.com/apache/skywalking/issues/5197
Please answer these questions before submitting your issue.
- Why do you submit this issue?
- [ ] Question or discussion
- [ 1 ] Bug
- [ ] Requirement
- [ ] Feature or performance improvement
___
### Question
- What do you want to know?
___
### Bug
- Which version of SkyWalking, OS and JRE?
6.0
- Which company or project?
- What happen?
I run agent in jdk14, it occurs error:
[ERROR][InstMethodsInter]class[class okhttp3.RealCall] before
method[execute] intercept failure
**java.lang.NoSuchFieldException: modifiers**
at java.base/java.lang.Class.getDeclaredField(Class.java:2489)
find this code in okhttp plugin:
Request request = (Request) objInst.getSkyWalkingDynamicField();
ContextCarrier contextCarrier = new ContextCarrier();
HttpUrl requestUrl = request.url();
AbstractSpan span = ContextManager.createExitSpan(requestUrl.uri()
.getPath(), contextCarrier, requestUrl.host() + ":" + requestUrl
.port());
span.setComponent(ComponentsDefine.OKHTTP);
Tags.HTTP.METHOD.set(span, request.method());
Tags.URL.set(span, requestUrl.uri().toString());
SpanLayer.asHttp(span);
Field headersField = Request.class.getDeclaredField("headers");
**Field modifiersField = Field.class.getDeclaredField("modifiers");**
modifiersField.setAccessible(true);
modifiersField.setInt(headersField, headersField.getModifiers() &
~Modifier.FINAL);
headersField.setAccessible(true);
Headers.Builder headerBuilder = request.headers().newBuilder();
CarrierItem next = contextCarrier.items();
while (next.hasNext()) {
next = next.next();
headerBuilder.add(next.getHeadKey(), next.getHeadValue());
}
headersField.set(request, headerBuilder.build());
Already remove this field in jdk14
**Field modifiersField = Field.class.getDeclaredField("modifiers");**
___
### Requirement or improvement
- Please describe about your requirements or improvement suggestions.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]