Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
3.2.0
Steps to reproduce this issue
1、consumer lazy init config
dubbo:consumer init=false
2、start your dubbo service
3、use arthas to invoke your dubbo service
you will get the NPE Exception
What you expected to happen
the invoke will be ok,not throw NPE Exception
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
2条答案
按热度按时间deikduxw1#
#14478 (comment)
deyfvvtc2#
when mH2i.getSerializerFactory().getClassLoader() is null , the NPE exception will occur
https://github.com/apache/dubbo/blob/3.2/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2ObjectInput.java#L113
public T readObject(Class cls, Type type) throws IOException, ClassNotFoundException {
if (!mH2i.getSerializerFactory().getClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
mH2i.setSerializerFactory(hessian2FactoryManager.getSerializerFactory(Thread.currentThread().getContextClassLoader()));
}
return readObject(cls);
}