-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
agentLanguage agent related.Language agent related.bugSomething isn't working and you are sure it's a bug!Something isn't working and you are sure it's a bug!pluginPlugin for agent or collector. Be used to extend the capabilities of default implementor.Plugin for agent or collector. Be used to extend the capabilities of default implementor.
Milestone
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Labels
agentLanguage agent related.Language agent related.bugSomething isn't working and you are sure it's a bug!Something isn't working and you are sure it's a bug!pluginPlugin for agent or collector. Be used to extend the capabilities of default implementor.Plugin for agent or collector. Be used to extend the capabilities of default implementor.