fix(3.2): injvm invoker throws ClassCastException #14346
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
The background is that I have a jvm and started two services. Because the two services have dependent jar packages that conflict, each service has its own class loader. Then because it is in a jvm, I want to use injvm rpc. Currently, Dubbo Core is shared, and SpringInjectExtension is isolated for each service class loader.
Now I encounter a ClassCaseException
There is a variable named consumerServiceModel, but its type is ProviderModule
I think the current Invoker is actually the consumer Thread. Then the Module in the url is the provider. If the consumer and provider class loaders are different, I understand that the classloader of the current Thread should be used directly instead of the classloader in the url.
So I commit this PR, and the code has been verified locally.
Brief changelog
Verifying this change
Checklist