Jason918 opened a new issue #11270:
URL: https://github.com/apache/pulsar/issues/11270
**Is your enhancement request related to a problem? Please describe.**
I am working on a new protocol handler for an existing mq implementation.
ClassNotFoundException occurs when I am calling methods like
`com.fastjson.JSON.parseObject("some json str", MyConfig.class)`. This happens
because the MyConfig.class is dynamically loaded by a NarClassLoader in
protocol hander mechanism, but current thread calling
`ProtocolHandler::initialize` uses the default class load in pulsar.
**Describe the solution you'd like**
IMHO, Maybe it's not very elegant for protocol handler to handle class
loader issue in its own project?
As there is an ProtocolHandlerWithClassLoader object in each protocol
handlers, I am suggesting change the thread default class loader to the
NarClassLoader before we call interfaces in ProtocolHandler.
**Describe alternatives you've considered**
Currently, I am getting the NarClassLoader through
`MyProtocolHandler.class.getClassLoader()`.
I think it's a bit of tricky.
**Additional context**
Add any other context or screenshots about the feature request here.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]