skywalking-java
skywalking-java copied to clipboard
fix:fix when enchance higher classes to hashmap cause NoClassDefFoun…
…dError
- [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #
. - [ ] Update the
CHANGES
log.
I change the skywalking-java-agent package for my personal using (I want a small agent, don't need many fuanctions of skywaling. ). But, when I launch the agent, here is the phenomenon:
The MethodInvocationContext is before MethodInterceptResult, so when load the MethodInvocationContext , will cause java.lang.NoClassDefFoundError.
Although the order of high loader classes is not out of order in the skywalking project. But I think we should ensure the load sequence should order by the define in the class.
the MethodInvocationContext is the subclass of MethodInterceptResult. if classloader load the MethodInvocationContext first, it couldn't find the MethodInterceptResult .so exception below:
java.lang. IllegalStateException Create breakpoint: java.lang.NoClassDefFoundError: com/maple/shine/apm/agent/core/plugin/interceptor/enhance/MethodInterceptResult
this is my customized class.
I am not sure this is the case. The class files could be cross-reference. Such as A is using B, and B is using A.
If Byte-buddy is asking for a sorted class map, it should be clear on the method's comment, which I can't find it. Have you checked with byte-buddy author about your case? Because you are using our codebases for private purposes, I can't confirm your change, unless the bytebuddy side could confirm the sequence matters.
resonable,I will check the bytebuddy's api, take some expriment.
The bytebuddy author's replay:
If there is a dependency, you need to inject the classes in the required order.
https://github.com/raphw/byte-buddy/issues/1299
Thanks for the update. You should update changes.md about this fix.
finished